Class: Jekyll::Amazon::AmazonTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::Amazon::AmazonTag
- Defined in:
- lib/jekyll-amazon/amazon_tag.rb
Constant Summary collapse
- DEFAULT_LOCALE =
'en'.freeze
- DEFAULT_COUNTRY =
'us'.freeze
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.
103 104 105 106 107 |
# File 'lib/jekyll-amazon/amazon_tag.rb', line 103 def initialize(tag_name, markup, tokens) super (markup) error "No ASIN given in #{tag_name} tag" if @asin.nil? || @asin.empty? end |
Instance Method Details
#render(context) ⇒ Object
109 110 111 112 113 114 115 |
# File 'lib/jekyll-amazon/amazon_tag.rb', line 109 def render(context) setup(context) setup_i18n item = AmazonResultCache.instance.item_lookup(@asin.to_s) return unless item render_from_file(@template_type, item) end |