Class: JekyllEmbedlyPlugin::EmbedlyTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- JekyllEmbedlyPlugin::EmbedlyTag
- Includes:
- Cacheable
- Defined in:
- lib/jekyll-embedly-plugin.rb
Instance Method Summary collapse
-
#initialize(tag_name, text, tokens) ⇒ EmbedlyTag
constructor
A new instance of EmbedlyTag.
- #render(context) ⇒ Object
Methods included from Cacheable
Constructor Details
#initialize(tag_name, text, tokens) ⇒ EmbedlyTag
Returns a new instance of EmbedlyTag.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/jekyll-embedly-plugin.rb', line 54 def initialize(tag_name, text, tokens) super tokens = text.split /\,\s/ @url = tokens[0] @parameters = {} @cache = FileCache.new tokens[1..-1].each do |arg| key, value = arg.split /:/ value ||= "1" @parameters[key.strip] = value.strip end end |
Instance Method Details
#render(context) ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/jekyll-embedly-plugin.rb', line 69 def render(context) @config = context.registers[:site].config["embedly"] @api_key = @config["api_key"] if @api_key.nil? raise EmbedlyTagError "You must provide embed.ly api key." end @url end |