Class: Coco::IconSprite

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
lib/coco/icon_sprite.rb

Instance Method Summary collapse

Constructor Details

#initialize(icons = []) ⇒ IconSprite

Returns a new instance of IconSprite.



5
6
7
8
# File 'lib/coco/icon_sprite.rb', line 5

def initialize(icons = [])
  @icons = icons
  @icons.freeze
end

Instance Method Details

#to_svgObject



10
11
12
13
14
# File 'lib/coco/icon_sprite.rb', line 10

def to_svg
  tag.svg xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" do
    ("\n" + symbols.join("\n  ") + "\n").html_safe
  end
end