Class: Tumblargh::Renderer::Blocks::Base
- Inherits:
-
Tumblargh::Renderer::Base
- Object
- Tumblargh::Renderer::Base
- Tumblargh::Renderer::Blocks::Base
- Defined in:
- lib/tumblargh/renderer/blocks/base.rb
Direct Known Subclasses
Album, AlbumArt, Artist, AskEnabled, AudioEmbed, AudioPlayer, Date, JumpPage, JumpPagination, Label, Lines, NewDayDate, NextPage, NextPost, NotReblog, NoteCount, Pagination, PermalinkPagination, Photos, PostNotes, Posts, PreviousPage, PreviousPost, RebloggedFrom, SameDayDate, SubmissionsEnabled, Tags, TrackName
Class Attribute Summary collapse
-
.should_render_if ⇒ Object
Returns the value of attribute should_render_if.
Attributes inherited from Tumblargh::Renderer::Base
Instance Method Summary collapse
Methods inherited from Tumblargh::Renderer::Base
#context_post, contextual_tag, #escape_html, #escape_url, #initialize, #method_missing, #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
Class Attribute Details
.should_render_if ⇒ Object
Returns the value of attribute should_render_if.
7 8 9 |
# File 'lib/tumblargh/renderer/blocks/base.rb', line 7 def should_render_if @should_render_if end |
Instance Method Details
#render ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tumblargh/renderer/blocks/base.rb', line 21 def render return '' unless should_render? _, type, , *nodes = node res = nodes.map do |n| renderer = Renderer.factory(n, self, ) renderer.render unless renderer.nil? end " #{ res.join('') } " end |
#should_render? ⇒ Boolean
12 13 14 15 16 17 18 19 |
# File 'lib/tumblargh/renderer/blocks/base.rb', line 12 def should_render? if defined?(@should_render_if) val = send(@should_render_if) return !(val || val.nil? || (val.respond_to?(:blank?) ? val.blank? : val.empty?)) end true end |