Class: SproutCore::ViewHelperSupport::HelperState
- Defined in:
- lib/sproutcore/deprecated/view_helper.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_helper ⇒ Object
readonly
Returns the value of attribute parent_helper.
-
#prepare_block ⇒ Object
readonly
Returns the value of attribute prepare_block.
Instance Method Summary collapse
-
#initialize(helper_name, opts = {}, &block) ⇒ HelperState
constructor
A new instance of HelperState.
- #prepare_context(render_context) ⇒ Object
Constructor Details
#initialize(helper_name, opts = {}, &block) ⇒ HelperState
Returns a new instance of HelperState.
510 511 512 513 514 515 516 517 |
# File 'lib/sproutcore/deprecated/view_helper.rb', line 510 def initialize(helper_name, opts={}, &block) @name = helper_name @prepare_block = block unless helper_name == :view @parent_helper = SproutCore::ViewHelperSupport.find_helper(opts[:wraps] || opts[:extends] || :view) end @extends = opts[:wraps].nil? end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
506 507 508 |
# File 'lib/sproutcore/deprecated/view_helper.rb', line 506 def name @name end |
#parent_helper ⇒ Object (readonly)
Returns the value of attribute parent_helper.
507 508 509 |
# File 'lib/sproutcore/deprecated/view_helper.rb', line 507 def parent_helper @parent_helper end |
#prepare_block ⇒ Object (readonly)
Returns the value of attribute prepare_block.
508 509 510 |
# File 'lib/sproutcore/deprecated/view_helper.rb', line 508 def prepare_block @prepare_block end |
Instance Method Details
#prepare_context(render_context) ⇒ Object
519 520 521 522 523 524 525 526 527 528 529 |
# File 'lib/sproutcore/deprecated/view_helper.rb', line 519 def prepare_context(render_context) # automatically call parent helper if extends was used. if parent_helper && @extends parent_helper.prepare_context(render_context) else render_context.current_helper = self end render_context.instance_eval &prepare_block render_context.current_helper = nil end |