Class: Savagery::Helpers
- Inherits:
-
Struct
- Object
- Struct
- Savagery::Helpers
- Defined in:
- lib/savagery/helpers.rb
Defined Under Namespace
Modules: Rails
Instance Attribute Summary collapse
-
#base_path ⇒ Object
Returns the value of attribute base_path.
Instance Method Summary collapse
Instance Attribute Details
#base_path ⇒ Object
Returns the value of attribute base_path
4 5 6 |
# File 'lib/savagery/helpers.rb', line 4 def base_path @base_path end |
Instance Method Details
#svg_sprite_include(path) ⇒ Object
5 6 7 8 |
# File 'lib/savagery/helpers.rb', line 5 def svg_sprite_include path svg_sprites_included.add path svg_sprite_read(path) end |
#svg_sprite_use(name, options = {}) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/savagery/helpers.rb', line 10 def svg_sprite_use name, ={} dirname, basename = name.split("/") sprite = svg_sprite_include(dirname) unless svg_sprites_included.include?(dirname) use = %(<svg class="#{[:class] || basename}"><use xlink:href="#{[:current_url]}##{basename}"></use></svg>) [sprite, use].join end |