Class: Stencil::If
- Defined in:
- lib/stencil/directives/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#truth ⇒ Object
readonly
Returns the value of attribute truth.
Instance Method Summary collapse
- #determine_truth(data) ⇒ Object
- #inspect_args ⇒ Object
- #render(state) ⇒ Object
- #setup_parameters(code) ⇒ Object
Methods inherited from Block
#add, #ended, #initialize, #inspect, #parsed
Methods inherited from Directive
#checked_render, create, #initialize, #inspect, #interpret, #parsed, #postrender, #pre_end, #prerender, register, #render_end
Constructor Details
This class inherits a constructor from Stencil::Block
Instance Attribute Details
#truth ⇒ Object (readonly)
Returns the value of attribute truth.
261 262 263 |
# File 'lib/stencil/directives/base.rb', line 261 def truth @truth end |
Instance Method Details
#determine_truth(data) ⇒ Object
267 268 269 270 |
# File 'lib/stencil/directives/base.rb', line 267 def determine_truth(data) @truth = interpret(@code, data) return @truth end |
#inspect_args ⇒ Object
263 264 265 |
# File 'lib/stencil/directives/base.rb', line 263 def inspect_args @code end |
#render(state) ⇒ Object
272 273 274 275 276 |
# File 'lib/stencil/directives/base.rb', line 272 def render(state) if determine_truth(state.data) return super end end |
#setup_parameters(code) ⇒ Object
257 258 259 260 |
# File 'lib/stencil/directives/base.rb', line 257 def setup_parameters(code) @code = code @truth = nil end |