Class: Pakyow::Presenter::BindingParts Private

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeBindingParts

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.

Returns:

  • (Boolean)


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_jsonObject

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