Class: Basicons::Basicon

Inherits:
Object
  • Object
show all
Defined in:
lib/basicons/basicon.rb

Constant Summary collapse

DEFAULT_HEIGHT =
16

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @symbol = symbol.to_s

  if basicon = find_basicon(@symbol, options)
  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

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/basicons/basicon.rb', line 5

def data
  @data
end

#heightObject (readonly)

Returns the value of attribute height.



6
7
8
# File 'lib/basicons/basicon.rb', line 6

def height
  @height
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/basicons/basicon.rb', line 6

def options
  @options
end

#symbolObject (readonly)

Returns the value of attribute symbol.



5
6
7
# File 'lib/basicons/basicon.rb', line 5

def symbol
  @symbol
end

#widthObject (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_svgObject



30
31
32
# File 'lib/basicons/basicon.rb', line 30

def to_svg
  "<svg #{html_attributes}>#{@path}</svg>"
end