Class: Crypticons::Crypticon
- Inherits:
-
Object
- Object
- Crypticons::Crypticon
- Defined in:
- lib/crypticons/crypticon.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#symbol ⇒ Object
readonly
Returns the value of attribute symbol.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(symbol, options = {}) ⇒ Crypticon
constructor
A new instance of Crypticon.
-
#to_svg ⇒ Object
Returns an string representing a <svg> tag.
Constructor Details
#initialize(symbol, options = {}) ⇒ Crypticon
Returns a new instance of Crypticon.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/crypticons/crypticon.rb', line 6 def initialize(symbol, = {}) @symbol = symbol.to_s if crypticon = Crypticons::CRYPTICON_SYMBOLS[@symbol] @path = crypticon["path"] @width = crypticon["width"].to_i @height = crypticon["height"].to_i @keywords = crypticon["keywords"] = .merge!({ class: classes, viewBox: viewbox, version: "1.1" }) .merge!(size) .merge!(a11y) else raise "Couldn't find crypticon symbol for #{@symbol.inspect}" end end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
4 5 6 |
# File 'lib/crypticons/crypticon.rb', line 4 def height @height end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
4 5 6 |
# File 'lib/crypticons/crypticon.rb', line 4 def keywords @keywords end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/crypticons/crypticon.rb', line 4 def end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/crypticons/crypticon.rb', line 4 def path @path end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
4 5 6 |
# File 'lib/crypticons/crypticon.rb', line 4 def symbol @symbol end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
4 5 6 |
# File 'lib/crypticons/crypticon.rb', line 4 def width @width end |
Instance Method Details
#to_svg ⇒ Object
Returns an string representing a <svg> tag
30 31 32 |
# File 'lib/crypticons/crypticon.rb', line 30 def to_svg "<svg #{html_attributes}>#{@path}</svg>" end |