Class: Scribble::Methods::If
- Inherits:
-
Block
- Object
- Scribble::Method
- Block
- Scribble::Methods::If
- Defined in:
- lib/scribble/methods/if.rb
Instance Method Summary collapse
Methods inherited from Block
Methods included from Support::Context
#converter, #evaluate, #format, included, #nodes, #registers, #render, #render_format, #render_without_conversion, #require_conversion?, #resolve_variable, #set_variable, #template, #variables
Methods inherited from Scribble::Method
block?, eql?, implement, #initialize, insert, max_arity, min_arity, register, setup, split?
Constructor Details
This class inherits a constructor from Scribble::Method
Instance Method Details
#else ⇒ Object
21 22 23 |
# File 'lib/scribble/methods/if.rb', line 21 def else @paths.unshift [true, nodes] end |
#elsif(object) ⇒ Object
15 16 17 |
# File 'lib/scribble/methods/if.rb', line 15 def elsif object @paths.unshift [Registry.to_boolean(object), split_nodes] end |
#if(object) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/scribble/methods/if.rb', line 6 def if object @paths = [] send :elsif, object render(nodes: @paths.map { |condition, nodes| nodes if condition }.compact.first || []) end |