Class: Octopress::Social::Email::Tag

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

Instance Method Summary collapse

Constructor Details

#initialize(tag, input, tokens) ⇒ Tag

Returns a new instance of Tag.



79
80
81
82
# File 'lib/octopress-social/email.rb', line 79

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

Instance Method Details

#render(context) ⇒ Object



84
85
86
87
88
89
90
91
92
# File 'lib/octopress-social/email.rb', line 84

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

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