Class: Argyle::Renderer
- Inherits:
-
Object
- Object
- Argyle::Renderer
- Defined in:
- lib/argyle/renderer.rb
Instance Method Summary collapse
-
#initialize(style_container) ⇒ Renderer
constructor
A new instance of Renderer.
- #render(page) ⇒ Object
- #set_view(component_klass, view_klass) ⇒ Object
Constructor Details
Instance Method Details
#render(page) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/argyle/renderer.rb', line 29 def render(page) windows = page.layout.windows page.components.each_value do |component| component_class = component.class area = component.area unless @views.include?(component_class) raise Argyle::Error::NotFound.new("View not found fo component #{component_class}") end raise Argyle::Error::NotFound.new("Window not found for area: #{area}") unless windows.include?(area) @views[component_class].render(windows[area], component) end windows.each_value(&:refresh) end |
#set_view(component_klass, view_klass) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/argyle/renderer.rb', line 17 def set_view(component_klass, view_klass) Argyle::Assert.klass(Argyle::Component::Base, component_klass) Argyle::Assert.klass(Argyle::View::Base, view_klass) @views[component_klass] = view_klass.new(@style_container) end |