Class: Luoma::ElseBlock
- Defined in:
- lib/luoma/tags/else.rb,
sig/luoma/tags/else.rbs
Instance Attribute Summary collapse
-
#block ⇒ t_block
readonly
Returns the value of attribute block.
-
#expression ⇒ Expression
readonly
Returns the value of attribute expression.
Attributes inherited from Markup
Instance Method Summary collapse
- #children(static_context) ⇒ Object
- #filter_strings ⇒ Object
-
#initialize(token, tag_name, block) ⇒ ElseBlock
constructor
(t_token, String, t_block) -> void.
- #render(context, buffer) ⇒ Object
Methods inherited from Markup
#block_scope, #expressions, #partial, #template_scope
Constructor Details
#initialize(token, tag_name, block) ⇒ ElseBlock
(t_token, String, t_block) -> void
8 9 10 11 12 13 14 |
# File 'lib/luoma/tags/else.rb', line 8 def initialize(token, tag_name, block) super(token) @tag_name = tag_name @expression = BooleanLiteral.new(token, true) @block = block @blank = Luoma.blank_block?(block) end |
Instance Attribute Details
#block ⇒ t_block (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'lib/luoma/tags/else.rb', line 5 def block @block end |
#expression ⇒ Expression (readonly)
Returns the value of attribute expression.
5 6 7 |
# File 'lib/luoma/tags/else.rb', line 5 def expression @expression end |
Instance Method Details
#children(static_context) ⇒ Object
22 23 24 |
# File 'lib/luoma/tags/else.rb', line 22 def children(static_context) @block.grep_v(String) #: Array[Markup] end |
#filter_strings ⇒ Object
26 27 28 |
# File 'lib/luoma/tags/else.rb', line 26 def filter_strings @block.filter! { |node| !node.is_a?(String) } end |
#render(context, buffer) ⇒ Object
17 18 19 |
# File 'lib/luoma/tags/else.rb', line 17 def render(context, buffer) Luoma.render_block(@block, context, buffer) end |