Class: GeoPattern::Pattern
- Inherits:
-
Object
- Object
- GeoPattern::Pattern
- Defined in:
- lib/geo_pattern/pattern.rb
Instance Attribute Summary collapse
-
#background ⇒ Object
Returns the value of attribute background.
-
#height ⇒ Object
Returns the value of attribute height.
-
#structure ⇒ Object
Returns the value of attribute structure.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
- #base64_string ⇒ Object deprecated Deprecated.
-
#generate_me(generator) ⇒ Object
Generate things for the pattern.
-
#include?(string) ⇒ Boolean
Check if string is included in pattern.
-
#initialize(svg_image = SvgImage.new) ⇒ Pattern
constructor
A new instance of Pattern.
- #svg_string ⇒ Object deprecated Deprecated.
-
#to_base64 ⇒ Object
Convert to base64.
-
#to_data_uri ⇒ Object
Convert to data uri.
-
#to_svg ⇒ Object
(also: #to_s)
Convert pattern to svg.
- #uri_image ⇒ Object deprecated Deprecated.
Constructor Details
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
9 10 11 |
# File 'lib/geo_pattern/pattern.rb', line 9 def background @background end |
#height ⇒ Object
Returns the value of attribute height.
9 10 11 |
# File 'lib/geo_pattern/pattern.rb', line 9 def height @height end |
#structure ⇒ Object
Returns the value of attribute structure.
9 10 11 |
# File 'lib/geo_pattern/pattern.rb', line 9 def structure @structure end |
#width ⇒ Object
Returns the value of attribute width.
9 10 11 |
# File 'lib/geo_pattern/pattern.rb', line 9 def width @width end |
Instance Method Details
#base64_string ⇒ Object
Deprecated.
66 67 68 69 70 |
# File 'lib/geo_pattern/pattern.rb', line 66 def base64_string $stderr.puts 'Using "#base64_string" is deprecated as of 1.3.1. Please use "#to_base64" instead.' to_base64 end |
#generate_me(generator) ⇒ Object
Generate things for the pattern
28 29 30 |
# File 'lib/geo_pattern/pattern.rb', line 28 def generate_me(generator) generator.generate self end |
#include?(string) ⇒ Boolean
Check if string is included in pattern
19 20 21 |
# File 'lib/geo_pattern/pattern.rb', line 19 def include?(string) image.include?(string) end |
#svg_string ⇒ Object
Deprecated.
58 59 60 61 62 |
# File 'lib/geo_pattern/pattern.rb', line 58 def svg_string $stderr.puts 'Using "#svg_string" is deprecated as of 1.3.1. Please use "#to_svg" instead.' to_svg end |
#to_base64 ⇒ Object
Convert to base64
39 40 41 |
# File 'lib/geo_pattern/pattern.rb', line 39 def to_base64 Base64.strict_encode64(to_svg) end |
#to_data_uri ⇒ Object
Convert to data uri
44 45 46 |
# File 'lib/geo_pattern/pattern.rb', line 44 def to_data_uri "url(data:image/svg+xml;base64,#{to_base64});" end |
#to_svg ⇒ Object Also known as: to_s
Convert pattern to svg
33 34 35 |
# File 'lib/geo_pattern/pattern.rb', line 33 def to_svg image.to_s end |
#uri_image ⇒ Object
Deprecated.
50 51 52 53 54 |
# File 'lib/geo_pattern/pattern.rb', line 50 def uri_image $stderr.puts 'Using "#uri_image" is deprecated as of 1.3.1. Please use "#to_data_uri" instead.' to_data_uri end |