Class: Basicons::Basicon
- Inherits:
-
Object
- Object
- Basicons::Basicon
- Defined in:
- lib/basicons/basicon.rb
Constant Summary collapse
- DEFAULT_HEIGHT =
16
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#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 = {}) ⇒ Basicon
constructor
A new instance of Basicon.
- #to_svg ⇒ Object
Constructor Details
#initialize(symbol, options = {}) ⇒ Basicon
Returns a new instance of Basicon.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/basicons/basicon.rb', line 8 def initialize(symbol, = {}) @symbol = symbol.to_s if basicon = find_basicon(@symbol, ) else raise "Couldn't find basicon symbol for #{@symbol.inspect}" end # @path = octicon["path"] # @width = octicon["width"] # @height = octicon["height"] # @options = options.dup # @options.merge!({ # class: classes, # viewBox: viewbox, # version: "1.1" # }) # @options.merge!(size) # @options.merge!(a11y) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
5 6 7 |
# File 'lib/basicons/basicon.rb', line 5 def data @data end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
6 7 8 |
# File 'lib/basicons/basicon.rb', line 6 def height @height end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/basicons/basicon.rb', line 6 def @options end |
#symbol ⇒ Object (readonly)
Returns the value of attribute symbol.
5 6 7 |
# File 'lib/basicons/basicon.rb', line 5 def symbol @symbol end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
6 7 8 |
# File 'lib/basicons/basicon.rb', line 6 def width @width end |
Instance Method Details
#to_svg ⇒ Object
30 31 32 |
# File 'lib/basicons/basicon.rb', line 30 def to_svg "<svg #{html_attributes}>#{@path}</svg>" end |