Class: ListPresenter
- Inherits:
-
Object
- Object
- ListPresenter
- Defined in:
- lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
Returns the value of attribute list.
-
#new_list_item ⇒ Object
Returns the value of attribute new_list_item.
Instance Method Summary collapse
- #append_list_item ⇒ Object
- #clear_new_list_item ⇒ Object
- #entering_new_list_item? ⇒ Boolean
-
#initialize ⇒ ListPresenter
constructor
A new instance of ListPresenter.
- #prepend_list_item ⇒ Object
Constructor Details
#initialize ⇒ ListPresenter
Returns a new instance of ListPresenter.
6 7 8 9 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 6 def initialize @list = [] @new_list_item = '' end |
Instance Attribute Details
#list ⇒ Object
Returns the value of attribute list.
4 5 6 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 4 def list @list end |
#new_list_item ⇒ Object
Returns the value of attribute new_list_item.
4 5 6 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 4 def new_list_item @new_list_item end |
Instance Method Details
#append_list_item ⇒ Object
11 12 13 14 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 11 def append_list_item list.push(new_list_item) clear_new_list_item end |
#clear_new_list_item ⇒ Object
21 22 23 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 21 def clear_new_list_item self.new_list_item = '' end |
#entering_new_list_item? ⇒ Boolean
25 26 27 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 25 def entering_new_list_item? new_list_item.empty? end |
#prepend_list_item ⇒ Object
16 17 18 19 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 16 def prepend_list_item list.prepend(new_list_item) clear_new_list_item end |