Class: Pakyow::Presenter::Views::Partial
- Inherits:
-
Pakyow::Presenter::View
- Object
- Pakyow::Presenter::View
- Pakyow::Presenter::Views::Partial
- Defined in:
- lib/pakyow/presenter/views/partial.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
-
#initialize(name, html = "", **args) ⇒ Partial
constructor
A new instance of Partial.
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_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) ⇒ Partial
Returns a new instance of Partial.
23 24 25 26 |
# File 'lib/pakyow/presenter/views/partial.rb', line 23 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/partial.rb', line 7 def name @name end |
Class Method Details
.from_object(name, object) ⇒ Object
16 17 18 19 20 |
# File 'lib/pakyow/presenter/views/partial.rb', line 16 def from_object(name, object) super(object).tap do |instance| instance.instance_variable_set(:@name, name) end end |
.load(path, content: nil, **args) ⇒ Object
10 11 12 13 14 |
# File 'lib/pakyow/presenter/views/partial.rb', line 10 def load(path, content: nil, **args) name = File.basename(path, ".*") name = name[1..-1] if name.start_with?("_") self.new(name.to_sym, content || File.read(path), **args) end |