Class: ListPresenter
- Inherits:
-
Object
- Object
- ListPresenter
- Defined in:
- lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb
Instance Attribute Summary collapse
-
#insert_index ⇒ Object
Returns the value of attribute insert_index.
-
#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 (also: #edit_list_disabled?)
-
#initialize ⇒ ListPresenter
constructor
A new instance of ListPresenter.
- #insert_list_item ⇒ Object
- #max_insert_index ⇒ Object
- #prepend_list_item ⇒ Object
Constructor Details
#initialize ⇒ ListPresenter
Returns a new instance of ListPresenter.
7 8 9 10 11 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 7 def initialize @list = [] @new_list_item = '' @insert_index = 0 end |
Instance Attribute Details
#insert_index ⇒ Object
Returns the value of attribute insert_index.
5 6 7 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 5 def insert_index @insert_index end |
#list ⇒ Object
Returns the value of attribute list.
5 6 7 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 5 def list @list end |
#new_list_item ⇒ Object
Returns the value of attribute new_list_item.
5 6 7 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 5 def new_list_item @new_list_item end |
Instance Method Details
#append_list_item ⇒ Object
13 14 15 16 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 13 def append_list_item list.push(new_list_item) clear_new_list_item end |
#clear_new_list_item ⇒ Object
28 29 30 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 28 def clear_new_list_item self.new_list_item = '' end |
#entering_new_list_item? ⇒ Boolean Also known as: edit_list_disabled?
32 33 34 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 32 def entering_new_list_item? new_list_item.empty? end |
#insert_list_item ⇒ Object
23 24 25 26 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 23 def insert_list_item list.insert(insert_index, new_list_item) clear_new_list_item end |
#max_insert_index ⇒ Object
37 38 39 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 37 def max_insert_index list.size end |
#prepend_list_item ⇒ Object
18 19 20 21 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_mutation_content_data_binding.rb', line 18 def prepend_list_item list.prepend(new_list_item) clear_new_list_item end |