Module: Scavenger::ViewHelpers

Defined in:
lib/scavenger/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#compressorObject



3
4
5
# File 'lib/scavenger/view_helpers.rb', line 3

def compressor
  @compressor ||= Scavenger::Compressor.new(Scavenger::Config.svg_directory)
end

#scavenger_sprite_pathObject



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, options = {})
  options[:class] = "#{Scavenger::Config.class_prefix}#{ref}" if options[:class].nil?
   :svg, "<use xlink:href=\"##{Scavenger::Config.id_prefix}#{ref}\"/>".html_safe, options
end

#svg_sprite_sheetObject



7
8
9
# File 'lib/scavenger/view_helpers.rb', line 7

def svg_sprite_sheet
   :svg, compressor.compress_dir.html_safe, style: "display:none;"
end