Class: Wee::Delegate

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

Overview

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

Instance Attribute Summary

Attributes inherited from Decoration

#next

Instance Method Summary collapse

Methods inherited from Decoration

#global?, #render_presenter_on

Methods inherited from Presenter

#render, #renderer_class

Constructor Details

#initialize(delegate) ⇒ Delegate

Returns a new instance of Delegate.



170
171
172
# File 'lib/wee/decoration.rb', line 170

def initialize(delegate)
  @delegate = delegate
end

Instance Method Details

#process_callbacks(callbacks) ⇒ Object

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



178
179
180
# File 'lib/wee/decoration.rb', line 178

def process_callbacks(callbacks)
  @delegate.decoration.process_callbacks(callbacks)
end

#render_on(r) ⇒ Object

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



186
187
188
# File 'lib/wee/decoration.rb', line 186

def render_on(r)
  @delegate.decoration.render_on(r)
end

#state(s) ⇒ 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 @next decoration (via super).



195
196
197
198
# File 'lib/wee/decoration.rb', line 195

def state(s)
  super
  @delegate.decoration.state(s)
end