Class: Pakyow::Presenter::Views::Layout
- Inherits:
-
Pakyow::Presenter::View
- Object
- Pakyow::Presenter::View
- Pakyow::Presenter::Views::Layout
- Defined in:
- lib/pakyow/presenter/views/layout.rb
Constant Summary
Constants inherited from Pakyow::Presenter::View
Pakyow::Presenter::View::INFO_MERGER
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Attributes inherited from Pakyow::Presenter::View
Class Method Summary collapse
Instance Method Summary collapse
- #build(page) ⇒ Object
- #container(name = Views::Page::DEFAULT_CONTAINER) ⇒ Object
-
#initialize(name, html = "", **args) ⇒ Layout
constructor
A new instance of Layout.
Methods inherited from Pakyow::Presenter::View
#==, #add_info, #after, #append, #attributes, #attributes=, #before, #bind, #binding?, #binding_name, #binding_prop?, #binding_props, #binding_scope?, #binding_scopes, #body, #channeled_binding_name, #channeled_binding_scope?, #clear, #component, #components, #container?, #each_binding, #each_binding_prop, #each_binding_scope, #find, #find_all, #find_partials, #form, #form?, #forms, from_object, from_view_or_string, #head, #html=, #info, #initialize_copy, #mixin, #partial?, #plural_binding_name, #plural_channeled_binding_name, #prepend, #remove, #replace, #singular_binding_name, #singular_channeled_binding_name, #soft_copy, #title, #to_html, #to_s, #transform, #version, #with
Constructor Details
#initialize(name, html = "", **args) ⇒ Layout
Returns a new instance of Layout.
15 16 17 18 |
# File 'lib/pakyow/presenter/views/layout.rb', line 15 def initialize(name, html = "", **args) @name = name super(html, **args) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/pakyow/presenter/views/layout.rb', line 7 def name @name end |
Class Method Details
.load(path, content: nil, **args) ⇒ Object
10 11 12 |
# File 'lib/pakyow/presenter/views/layout.rb', line 10 def load(path, content: nil, **args) self.new(File.basename(path, ".*").to_sym, content || File.read(path), **args) end |
Instance Method Details
#build(page) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/pakyow/presenter/views/layout.rb', line 24 def build(page) @object.each_significant_node(:container) do |container_node| container_node.replace(page.content(container_node.label(:container))) end View.from_object(@object).add_info(info, page.info) end |
#container(name = Views::Page::DEFAULT_CONTAINER) ⇒ Object
20 21 22 |
# File 'lib/pakyow/presenter/views/layout.rb', line 20 def container(name = Views::Page::DEFAULT_CONTAINER) @object.container(name.to_sym) end |