Method: Basicons::Basicon#initialize

Defined in:
lib/basicons/basicon.rb

#initialize(symbol, options = {}) ⇒ Basicon

Returns a new instance of Basicon.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/basicons/basicon.rb', line 12

def initialize(symbol, options = {})
  @symbol = symbol.to_s
  @options = options.dup

  if @data = Basicons::SVG_DATA[@symbol]
    @options.merge!({
      class: classes,
      width: svg_size,
      height: svg_size,
      viewBox: '0 0 24 24',
      stroke: 'currentColor',
      fill: 'none'
    })

    @options.delete(:size)
    @options['stroke-width'] = 2
    @options['stroke-linecap'] = 'round'
    @options['stroke-linejoin'] = 'round'
    @options['xmlns'] = 'http://www.w3.org/2000/svg'
  else
    raise "<#{@symbol}> not found"
  end
end