Class: HelloFormMvpPresenter
- Inherits:
-
Object
- Object
- HelloFormMvpPresenter
- Defined in:
- lib/glimmer-dsl-web/samples/hello/hello_form_mvp/presenters/hello_form_mvp_presenter.rb
Instance Attribute Summary collapse
-
#contacts ⇒ Object
Returns the value of attribute contacts.
Instance Method Summary collapse
- #add_contact ⇒ Object
- #fetch_contacts ⇒ Object
-
#initialize ⇒ HelloFormMvpPresenter
constructor
A new instance of HelloFormMvpPresenter.
- #new_contact ⇒ Object
Constructor Details
#initialize ⇒ HelloFormMvpPresenter
Returns a new instance of HelloFormMvpPresenter.
6 7 8 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_form_mvp/presenters/hello_form_mvp_presenter.rb', line 6 def initialize @contacts = fetch_contacts end |
Instance Attribute Details
#contacts ⇒ Object
Returns the value of attribute contacts.
4 5 6 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_form_mvp/presenters/hello_form_mvp_presenter.rb', line 4 def contacts @contacts end |
Instance Method Details
#add_contact ⇒ Object
21 22 23 24 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_form_mvp/presenters/hello_form_mvp_presenter.rb', line 21 def add_contact contacts << Contact.new(name: new_contact.name, email: new_contact.email) new_contact.name = new_contact.email = '' end |
#fetch_contacts ⇒ Object
10 11 12 13 14 15 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_form_mvp/presenters/hello_form_mvp_presenter.rb', line 10 def fetch_contacts [ Contact.new(name: 'John Doe', email: '[email protected]'), Contact.new(name: 'Jane Doe', email: '[email protected]'), ] end |
#new_contact ⇒ Object
17 18 19 |
# File 'lib/glimmer-dsl-web/samples/hello/hello_form_mvp/presenters/hello_form_mvp_presenter.rb', line 17 def new_contact @new_contact ||= Contact.new end |