Class: ImageForProduct
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- ImageForProduct
- Defined in:
- app/liquid/tags/spree_tags.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ ImageForProduct
constructor
A new instance of ImageForProduct.
- #render(context) ⇒ Object
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 |