Class: Moft::Tags::PostUrl
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Moft::Tags::PostUrl
- Defined in:
- lib/moft/tags/post_url.rb
Instance Method Summary collapse
-
#initialize(tag_name, post, tokens) ⇒ PostUrl
constructor
A new instance of PostUrl.
- #render(context) ⇒ Object
Constructor Details
#initialize(tag_name, post, tokens) ⇒ PostUrl
Returns a new instance of PostUrl.
23 24 25 26 27 |
# File 'lib/moft/tags/post_url.rb', line 23 def initialize(tag_name, post, tokens) super @orig_post = post.strip @post = PostComparer.new(@orig_post) end |
Instance Method Details
#render(context) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/moft/tags/post_url.rb', line 29 def render(context) site = context.registers[:site] site.posts.each do |p| if @post == p return p.url end end puts "ERROR: post_url: \"#{@orig_post}\" could not be found" return "#" end |