class Savagery::Helpers
Public Instance Methods
svg_sprite_include(path)
click to toggle source
# 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={})
click to toggle source
# File lib/savagery/helpers.rb, line 10 def svg_sprite_use name, options={} dirname, basename = name.split("/") sprite = svg_sprite_include(dirname) unless svg_sprites_included.include?(dirname) use = %(<svg class="#{options[:class] || basename}"><use xlink:href="#{options[:current_url]}##{basename}"></use></svg>) [sprite, use].join end
Private Instance Methods
svg_sprite_path(path)
click to toggle source
# File lib/savagery/helpers.rb, line 27 def svg_sprite_path path File.join(base_path, "#{path}.svg") end
svg_sprite_read(path)
click to toggle source
# File lib/savagery/helpers.rb, line 23 def svg_sprite_read path File.read(svg_sprite_path(path)) end
svg_sprites_included()
click to toggle source
# File lib/savagery/helpers.rb, line 19 def svg_sprites_included @svg_sprites_included ||= Set.new end