Class: TwitterJekyll::TwitterTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-twitter-plugin.rb

Overview

Class to respond to Jekyll tag; entry point to library

Direct Known Subclasses

TwitterTagNoCache

Constant Summary collapse

ERROR_BODY_TEXT =
"<p>Tweet could not be processed</p>".freeze
OEMBED_ARG =
"oembed".freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(_name, params, _tokens) ⇒ TwitterTag

Returns a new instance of TwitterTag.



147
148
149
150
# File 'lib/jekyll-twitter-plugin.rb', line 147

def initialize(_name, params, _tokens)
  super
  @api_request = parse_params(params)
end

Instance Attribute Details

#cache=(value) ⇒ Object

for testing



145
146
147
# File 'lib/jekyll-twitter-plugin.rb', line 145

def cache=(value)
  @cache = value
end

Class Method Details

.cache_klassObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Class that implements caching strategy



154
155
156
# File 'lib/jekyll-twitter-plugin.rb', line 154

def self.cache_klass
  FileCache
end

Instance Method Details

#render(context) ⇒ Object

Return html string for Jekyll engine



160
161
162
163
164
# File 'lib/jekyll-twitter-plugin.rb', line 160

def render(context)
  api_secrets_deprecation_warning(context) # TODO: remove after deprecation cycle
  response = cached_response || live_response
  html_output_for(response)
end