Class: Pakyow::Presenter::BindingParts Private
- Inherits:
-
Object
- Object
- Pakyow::Presenter::BindingParts
- Defined in:
- lib/pakyow/presenter/binding_parts.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #accept(*parts) ⇒ Object private
- #content(view) ⇒ Object private
- #content? ⇒ Boolean private
- #define_part(name, block) ⇒ Object private
-
#initialize ⇒ BindingParts
constructor
private
A new instance of BindingParts.
- #non_content_values(view) ⇒ Object private
- #reject(*parts) ⇒ Object private
- #to_json ⇒ Object private
- #values(view) ⇒ Object private
Constructor Details
#initialize ⇒ BindingParts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of BindingParts.
7 8 9 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 7 def initialize @parts = {} end |
Instance Method Details
#accept(*parts) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
38 39 40 41 42 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 38 def accept(*parts) return if parts.empty? parts = parts.map(&:to_sym) @parts.keep_if { |key, _| parts.include? key } end |
#content(view) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 19 def content(view) @parts[:content].call(view.text) end |
#content? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 15 def content? @parts.include?(:content) end |
#define_part(name, block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 11 def define_part(name, block) @parts[name] = block end |
#non_content_values(view) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 27 def non_content_values(view) values_for_parts(@parts.reject { |name, _| name == :content }, view) end |
#reject(*parts) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 36 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 33 def reject(*parts) parts = parts.map(&:to_sym) @parts.delete_if { |key, _| parts.include? key } end |
#to_json ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 44 def to_json(*) @parts.to_json end |
#values(view) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/pakyow/presenter/binding_parts.rb', line 23 def values(view) values_for_parts(@parts, view) end |