Class: Fontico::Emitters::Sprite
- Inherits:
-
Object
- Object
- Fontico::Emitters::Sprite
- Defined in:
- lib/fontico/emitters/sprite.rb
Overview
One
Instance Method Summary collapse
- #accepts?(_icon) ⇒ Boolean
- #call ⇒ Object
-
#initialize(manifest, build) ⇒ Sprite
constructor
A new instance of Sprite.
- #rules_only? ⇒ Boolean
Constructor Details
#initialize(manifest, build) ⇒ Sprite
Returns a new instance of Sprite.
8 9 10 11 |
# File 'lib/fontico/emitters/sprite.rb', line 8 def initialize(manifest, build) @manifest = manifest @build = build end |
Instance Method Details
#accepts?(_icon) ⇒ Boolean
13 |
# File 'lib/fontico/emitters/sprite.rb', line 13 def accepts?(_icon) = true |
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fontico/emitters/sprite.rb', line 16 def call symbols = @build.map do |icon, body| %(<symbol id="#{icon.key}" viewBox="0 0 #{@manifest.size} #{@manifest.size}" ) + %(fill="none">#{body}</symbol>) end <<~SVG <svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" style="display:none"> #{symbols.join("\n")} </svg> SVG end |
#rules_only? ⇒ Boolean
14 |
# File 'lib/fontico/emitters/sprite.rb', line 14 def rules_only? = false |