Class: Jekyll::Amazon::AmazonTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Amazon::AmazonTag
- Defined in:
- lib/jekyll-amazon/amazon_tag.rb
Instance Attribute Summary collapse
-
#asin ⇒ Object
Returns the value of attribute asin.
-
#template_type ⇒ Object
Returns the value of attribute template_type.
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ AmazonTag
constructor
A new instance of AmazonTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, markup, tokens) ⇒ AmazonTag
Returns a new instance of AmazonTag.
136 137 138 139 140 |
# File 'lib/jekyll-amazon/amazon_tag.rb', line 136 def initialize(tag_name, markup, tokens) super (markup) error "No ASIN given in #{tag_name} tag" if asin.nil? || asin.empty? end |
Instance Attribute Details
#asin ⇒ Object
Returns the value of attribute asin.
133 134 135 |
# File 'lib/jekyll-amazon/amazon_tag.rb', line 133 def asin @asin end |
#template_type ⇒ Object
Returns the value of attribute template_type.
134 135 136 |
# File 'lib/jekyll-amazon/amazon_tag.rb', line 134 def template_type @template_type end |
Instance Method Details
#render(context) ⇒ Object
142 143 144 145 146 147 148 |
# File 'lib/jekyll-amazon/amazon_tag.rb', line 142 def render(context) type = template_type || :detail AmazonResultCache.instance.setup(context) item = AmazonResultCache.instance.item_lookup(asin.to_s) return unless item send(type, item) end |