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.
210 211 212 213 214 215 |
# File 'lib/flavour_saver/runtime.rb', line 210 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
217 218 219 220 |
# File 'lib/flavour_saver/runtime.rb', line 217 def contents(context=@block_context,locals={}) @render_count += 1 @content_runtime.to_s(context,locals) if @content_runtime end |
#has_inverse? ⇒ Boolean
227 228 229 |
# File 'lib/flavour_saver/runtime.rb', line 227 def has_inverse? !!@alternate_runtime end |
#inverse(context = @block_context) ⇒ Object
222 223 224 225 |
# File 'lib/flavour_saver/runtime.rb', line 222 def inverse(context=@block_context) @render_count += 1 @alternate_runtime.to_s(context) if @alternate_runtime end |
#rendered! ⇒ Object
235 236 237 |
# File 'lib/flavour_saver/runtime.rb', line 235 def rendered! @render_count += 1 end |
#rendered? ⇒ Boolean
231 232 233 |
# File 'lib/flavour_saver/runtime.rb', line 231 def rendered? @render_count > 0 ? @render_count : false end |