Class: Octopress::Social::Twitter::Tag

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

Instance Method Summary collapse

Constructor Details

#initialize(tag, input, tokens) ⇒ Tag

Returns a new instance of Tag.



130
131
132
133
# File 'lib/octopress-social/twitter.rb', line 130

def initialize(tag, input, tokens)
  @tag = tag.strip
  @input = input.strip
end

Instance Method Details

#render(context) ⇒ Object



135
136
137
138
139
140
141
142
# File 'lib/octopress-social/twitter.rb', line 135

def render(context)
  site = context['site']
  item = Octopress::Social.item(context, @input)

  Octopress::Social::Twitter.set_config(site)
  Octopress::Social::Twitter.set_url(site, item)
  Octopress::Social::Twitter.send(@tag, site, item).gsub(/(\s{2,}|\n)/, ' ').strip
end