Class: Tumblargh::Renderer::Blocks::NoteCount
- Inherits:
-
Base
- Object
- Tumblargh::Renderer::Base
- Base
- Tumblargh::Renderer::Blocks::NoteCount
- Defined in:
- lib/tumblargh/renderer/blocks/notes.rb
Overview
Rendered if this post has notes. Always wrap note counts in this block so they will be properly hidden on non-post pages.
Instance Attribute Summary
Attributes inherited from Tumblargh::Renderer::Base
Instance Method Summary collapse
Methods inherited from Base
Methods inherited from Tumblargh::Renderer::Base
#context_post, contextual_tag, #escape_html, #escape_url, #initialize, #method_missing, #render, #strip_html
Constructor Details
This class inherits a constructor from Tumblargh::Renderer::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Tumblargh::Renderer::Base
Instance Method Details
#note_count ⇒ Object
57 58 59 |
# File 'lib/tumblargh/renderer/blocks/notes.rb', line 57 def note_count context_post.note_count || 0 end |
#note_count_with_label ⇒ Object
61 62 63 64 |
# File 'lib/tumblargh/renderer/blocks/notes.rb', line 61 def note_count_with_label count = note_count "#{ count } note#{ count == 1 ? '' : 's' }" end |
#should_render? ⇒ Boolean
53 54 55 |
# File 'lib/tumblargh/renderer/blocks/notes.rb', line 53 def should_render? note_count > 0 end |