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! 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!

Methods inherited from Presenter

#render, #renderer_class

Constructor Details

#initialize(delegate) ⇒ Delegate

Returns a new instance of Delegate.



79
80
81
# File 'lib/wee/decoration.rb', line 79

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.



87
88
89
# File 'lib/wee/decoration.rb', line 87

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

#render!(r) ⇒ Object

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



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

def render!(r)
  @delegate.decoration.render!(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).



104
105
106
107
# File 'lib/wee/decoration.rb', line 104

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