Class: Wee::Delegate

Inherits:
Decoration show all
Defined in:
lib/wee/core/decoration.rb

Overview

A Wee::Delegate breaks the decoration chain and forwards the methods #process_callbacks, #do_render and #backtrack_state to the corresponding chain method of it’s delegate component (a Wee::Component).

Instance Attribute Summary

Attributes inherited from Decoration

#owner

Instance Method Summary collapse

Methods inherited from Decoration

#global?, #restore_snapshot, #take_snapshot

Methods inherited from Presenter

#get_property, #lookup_property, #properties, #properties=, #render, #session, template, uses_property

Constructor Details

#initialize(delegate) ⇒ Delegate

Returns a new instance of Delegate.



89
90
91
# File 'lib/wee/core/decoration.rb', line 89

def initialize(delegate)
  @delegate = delegate
end

Instance Method Details

#backtrack_state(snapshot) ⇒ Object

Forwards method to the corresponding top-level chain method of the delegate component. We also take snapshots of all non-visible components, thus we follow the @owner (via super).



111
112
113
114
# File 'lib/wee/core/decoration.rb', line 111

def backtrack_state(snapshot)
  super
  @delegate.backtrack_state_chain(snapshot)
end

#do_render(rendering_context) ⇒ Object

Forwards method to the corresponding top-level chain method of the delegate component.



103
104
105
# File 'lib/wee/core/decoration.rb', line 103

def do_render(rendering_context)
  @delegate.do_render_chain(rendering_context)
end

#process_callbacks(&block) ⇒ Object

Forwards method to the corresponding top-level chain method of the delegate component.



96
97
98
# File 'lib/wee/core/decoration.rb', line 96

def process_callbacks(&block)
  @delegate.process_callbacks_chain(&block)
end