Class: ImageForProduct

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
app/liquid/tags/spree_tags.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ ImageForProduct

Returns a new instance of ImageForProduct.



3
4
5
6
7
8
9
10
11
# File 'app/liquid/tags/spree_tags.rb', line 3

def initialize(tag_name, markup, tokens)
  unless markup.empty?
    if markup =~ /style:([-_a-z0-9]+)/
      @style = $1
    end
  end

  super
end

Instance Method Details

#render(context) ⇒ Object



13
14
15
# File 'app/liquid/tags/spree_tags.rb', line 13

def render(context)
  context.registers[:action_view].send("#{@style}_image".to_sym, context["product"].source)
end