Class: MotionPixateLayout::Proxy
- Inherits:
-
Object
- Object
- MotionPixateLayout::Proxy
- Defined in:
- lib/motion-pixate-layout/proxy.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
readonly
Returns the value of attribute controller.
Instance Method Summary collapse
- #apply_attributes ⇒ Object
- #apply_selector ⇒ Object
-
#initialize(controller) ⇒ Proxy
constructor
A new instance of Proxy.
- #layout ⇒ Object
- #run ⇒ Object
- #run_blocks(context, blocks) ⇒ Object
- #view ⇒ Object
- #view_proxy ⇒ Object
Constructor Details
#initialize(controller) ⇒ Proxy
Returns a new instance of Proxy.
5 6 7 |
# File 'lib/motion-pixate-layout/proxy.rb', line 5 def initialize(controller) @controller = controller end |
Instance Attribute Details
#controller ⇒ Object (readonly)
Returns the value of attribute controller.
3 4 5 |
# File 'lib/motion-pixate-layout/proxy.rb', line 3 def controller @controller end |
Instance Method Details
#apply_attributes ⇒ Object
43 44 45 46 47 48 |
# File 'lib/motion-pixate-layout/proxy.rb', line 43 def apply_attributes layout.view_attributes ||= [] layout.view_attributes.each do |key, value| view.public_send "#{key}=", value end end |
#apply_selector ⇒ Object
32 33 34 35 36 37 |
# File 'lib/motion-pixate-layout/proxy.rb', line 32 def apply_selector if layout.selector view.styleId = layout.selector.style_id view.styleClass = layout.selector.style_classes.join(' ') end end |
#layout ⇒ Object
13 14 15 |
# File 'lib/motion-pixate-layout/proxy.rb', line 13 def layout controller.pixate_layout end |
#run ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/motion-pixate-layout/proxy.rb', line 17 def run apply_selector apply_attributes run_blocks controller, layout.before view_proxy.run_blocks run_blocks controller, layout.after controller.view.updateStyles end |
#run_blocks(context, blocks) ⇒ Object
39 40 41 |
# File 'lib/motion-pixate-layout/proxy.rb', line 39 def run_blocks(context, blocks) blocks.each { |block| context.instance_eval &block } end |
#view ⇒ Object
9 10 11 |
# File 'lib/motion-pixate-layout/proxy.rb', line 9 def view controller.view end |