Module: Silverdot::ImageHelper

Defined in:
lib/silverdot/helpers/image_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
# File 'lib/silverdot/helpers/image_helper.rb', line 3

def self.included(base)
  base.alias_method_chain :image_path, :alternative
  base.alias_method_chain :image_alt, :alternative
end

Instance Method Details

#image_alt_with_alternative(src) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/silverdot/helpers/image_helper.rb', line 18

def image_alt_with_alternative(src)
  case src
  when Alternative
    src.parent.alt
  else
    image_alt_without_alternative(src)
  end
end

#image_path_with_alternative(source) ⇒ Object Also known as: path_to_image



8
9
10
11
12
13
14
15
# File 'lib/silverdot/helpers/image_helper.rb', line 8

def image_path_with_alternative(source)
  case source
  when Alternative
    source.src
  else
    image_path_without_alternative(source)
  end
end