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
#initialize(svg_image = SvgImage.new) ⇒ Pattern
Returns a new instance of Pattern.
13 14 15 |
# File 'lib/geo_pattern/pattern.rb', line 13 def initialize(svg_image = SvgImage.new) @svg_image = svg_image end |
Instance Attribute Details
#background ⇒ Object
Returns the value of attribute background.
11 12 13 |
# File 'lib/geo_pattern/pattern.rb', line 11 def background @background end |
#height ⇒ Object
Returns the value of attribute height.
11 12 13 |
# File 'lib/geo_pattern/pattern.rb', line 11 def height @height end |
#structure ⇒ Object
Returns the value of attribute structure.
11 12 13 |
# File 'lib/geo_pattern/pattern.rb', line 11 def structure @structure end |
#width ⇒ Object
Returns the value of attribute width.
11 12 13 |
# File 'lib/geo_pattern/pattern.rb', line 11 def width @width end |
Instance Method Details
#base64_string ⇒ Object
Deprecated.
68 69 70 71 72 |
# File 'lib/geo_pattern/pattern.rb', line 68 def base64_string warn '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
30 31 32 |
# File 'lib/geo_pattern/pattern.rb', line 30 def generate_me(generator) generator.generate self end |
#include?(string) ⇒ Boolean
Check if string is included in pattern
21 22 23 |
# File 'lib/geo_pattern/pattern.rb', line 21 def include?(string) image.include?(string) end |
#svg_string ⇒ Object
Deprecated.
60 61 62 63 64 |
# File 'lib/geo_pattern/pattern.rb', line 60 def svg_string warn 'Using "#svg_string" is deprecated as of 1.3.1. Please use "#to_svg" instead.' to_svg end |
#to_base64 ⇒ Object
Convert to base64
41 42 43 |
# File 'lib/geo_pattern/pattern.rb', line 41 def to_base64 Base64.strict_encode64(to_svg) end |
#to_data_uri ⇒ Object
Convert to data uri
46 47 48 |
# File 'lib/geo_pattern/pattern.rb', line 46 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
35 36 37 |
# File 'lib/geo_pattern/pattern.rb', line 35 def to_svg image.to_s end |
#uri_image ⇒ Object
Deprecated.
52 53 54 55 56 |
# File 'lib/geo_pattern/pattern.rb', line 52 def uri_image warn 'Using "#uri_image" is deprecated as of 1.3.1. Please use "#to_data_uri" instead.' to_data_uri end |