Class: TwitterJekyll::TwitterTag

Inherits:
Liquid::Tag
  • Object
show all
Defined in:
lib/jekyll-twitter-plugin-2.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.



149
150
151
152
# File 'lib/jekyll-twitter-plugin-2.rb', line 149

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

Instance Attribute Details

#cache=(value) ⇒ Object

for testing



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

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



156
157
158
# File 'lib/jekyll-twitter-plugin-2.rb', line 156

def self.cache_klass
  FileCache
end

Instance Method Details

#render(context) ⇒ Object

Return html string for Jekyll engine



162
163
164
165
166
# File 'lib/jekyll-twitter-plugin-2.rb', line 162

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