Class: Tumblargh::Renderer::Blocks::NumberedPost

Inherits:
Tumblargh::Renderer::Base show all
Defined in:
lib/tumblargh/renderer/blocks.rb

Instance Attribute Summary collapse

Attributes inherited from Tumblargh::Renderer::Base

#context, #node, #options

Instance Method Summary collapse

Methods inherited from Tumblargh::Renderer::Base

#context_post, contextual_tag, #escape_html, #escape_url, #method_missing, #render, #strip_html

Constructor Details

#initialize(node, context, *args) ⇒ NumberedPost

Returns a new instance of NumberedPost.



16
17
18
19
# File 'lib/tumblargh/renderer/blocks.rb', line 16

def initialize(node, context, *args)
  @num = args[0]
  super(node, context)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Tumblargh::Renderer::Base

Instance Attribute Details

#numObject (readonly)

Returns the value of attribute num.



14
15
16
# File 'lib/tumblargh/renderer/blocks.rb', line 14

def num
  @num
end

Instance Method Details

#should_render?Boolean

Returns:



21
22
23
# File 'lib/tumblargh/renderer/blocks.rb', line 21

def should_render?
  num == context.posts.index(context_post) + 1
end