Class: FluentIcons::Fluent

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent-icons/fluent.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Fluent.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/fluent-icons/fluent.rb', line 5

def initialize(symbol, options = {})
  @symbol = symbol.to_s
  @style  = (options[:style] || 'regular').to_s
  @weight = (options[:weight] || 20).to_s
  @prefix = (options[:prefix] || 'fluent').to_s

  if (fluent = get_fluent_path(@symbol, style, weight, options))
    @path       = fluent[:path]
    @width      = fluent[:width] || 20
    @height     = fluent[:height] || 20
    @keywords   = fluent[:keywords] || []
    @options    = options.dup
    
    @options.merge!({
      class:   classes,
      viewBox: viewbox,
      version: '1.1'
    })

    @options.merge!(a11y)
  else
    raise "Couldn't find octicon symbol for #{ @symbol.inspect }"
  end
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def height
  @height
end

#keywordsObject (readonly)

Returns the value of attribute keywords.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def keywords
  @keywords
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def options
  @options
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def path
  @path
end

#prefixObject (readonly)

Returns the value of attribute prefix.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def prefix
  @prefix
end

#styleObject (readonly)

Returns the value of attribute style.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def style
  @style
end

#symbolObject (readonly)

Returns the value of attribute symbol.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def symbol
  @symbol
end

#weightObject (readonly)

Returns the value of attribute weight.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def weight
  @weight
end

#widthObject (readonly)

Returns the value of attribute width.



3
4
5
# File 'lib/fluent-icons/fluent.rb', line 3

def width
  @width
end

Instance Method Details

#to_svgObject



30
31
32
# File 'lib/fluent-icons/fluent.rb', line 30

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