Module: Scavenger::ViewHelpers
- Defined in:
- lib/scavenger/view_helpers.rb
Instance Method Summary collapse
- #compressor ⇒ Object
- #scavenger_sprite_path ⇒ Object
- #svg(ref, options = {}) ⇒ Object
- #svg_sprite_sheet ⇒ Object
Instance Method Details
#compressor ⇒ Object
3 4 5 |
# File 'lib/scavenger/view_helpers.rb', line 3 def compressor @compressor ||= Scavenger::Compressor.new(Scavenger::Config.svg_directory) end |
#scavenger_sprite_path ⇒ Object
16 17 18 |
# File 'lib/scavenger/view_helpers.rb', line 16 def scavenger_sprite_path asset_path File.basename(Scavenger::Config.sprite_path) end |
#svg(ref, options = {}) ⇒ Object
11 12 13 14 |
# File 'lib/scavenger/view_helpers.rb', line 11 def svg(ref, = {}) [:class] = "#{Scavenger::Config.class_prefix}#{ref}" if [:class].nil? content_tag :svg, "<use xlink:href=\"##{Scavenger::Config.id_prefix}#{ref}\"/>".html_safe, end |
#svg_sprite_sheet ⇒ Object
7 8 9 |
# File 'lib/scavenger/view_helpers.rb', line 7 def svg_sprite_sheet content_tag :svg, compressor.compress_dir.html_safe, style: "display:none;" end |