Class: FlavourSaver::Runtime::BlockRuntime
- Inherits:
-
Object
- Object
- FlavourSaver::Runtime::BlockRuntime
- Defined in:
- lib/flavour_saver/runtime.rb
Instance Method Summary collapse
- #contents(context = @block_context, locals = {}) ⇒ Object
- #has_inverse? ⇒ Boolean
-
#initialize(block_context, content_runtime, alternate_runtime = nil) ⇒ BlockRuntime
constructor
A new instance of BlockRuntime.
- #inverse(context = @block_context) ⇒ Object
- #rendered! ⇒ Object
- #rendered? ⇒ Boolean
Constructor Details
#initialize(block_context, content_runtime, alternate_runtime = nil) ⇒ BlockRuntime
Returns a new instance of BlockRuntime.
214 215 216 217 218 219 |
# File 'lib/flavour_saver/runtime.rb', line 214 def initialize(block_context,content_runtime,alternate_runtime=nil) @block_context = block_context @content_runtime = content_runtime @alternate_runtime = alternate_runtime @render_count = 0 end |
Instance Method Details
#contents(context = @block_context, locals = {}) ⇒ Object
221 222 223 224 |
# File 'lib/flavour_saver/runtime.rb', line 221 def contents(context=@block_context,locals={}) @render_count += 1 @content_runtime.to_s(context,locals) if @content_runtime end |
#has_inverse? ⇒ Boolean
231 232 233 |
# File 'lib/flavour_saver/runtime.rb', line 231 def has_inverse? !!@alternate_runtime end |
#inverse(context = @block_context) ⇒ Object
226 227 228 229 |
# File 'lib/flavour_saver/runtime.rb', line 226 def inverse(context=@block_context) @render_count += 1 @alternate_runtime.to_s(context) if @alternate_runtime end |
#rendered! ⇒ Object
239 240 241 |
# File 'lib/flavour_saver/runtime.rb', line 239 def rendered! @render_count += 1 end |
#rendered? ⇒ Boolean
235 236 237 |
# File 'lib/flavour_saver/runtime.rb', line 235 def rendered? @render_count > 0 ? @render_count : false end |