Class: Auther::Presenter::Account
- Inherits:
-
Object
- Object
- Auther::Presenter::Account
- Includes:
- ActiveModel::Validations
- Defined in:
- app/presenters/auther/account.rb
Overview
Adapter for presenting an account within a view.
Instance Attribute Summary collapse
-
#login ⇒ Object
Returns the value of attribute login.
-
#name ⇒ Object
Returns the value of attribute name.
-
#password ⇒ Object
Returns the value of attribute password.
Instance Method Summary collapse
- #error?(key) ⇒ Boolean
- #error_message(key) ⇒ Object
-
#initialize(name: "", login: "", password: "") ⇒ Account
constructor
A new instance of Account.
Constructor Details
#initialize(name: "", login: "", password: "") ⇒ Account
Returns a new instance of Account.
15 16 17 18 19 |
# File 'app/presenters/auther/account.rb', line 15 def initialize name: "", login: "", password: "" @name = name @login = login @password = password end |
Instance Attribute Details
#login ⇒ Object
Returns the value of attribute login.
11 12 13 |
# File 'app/presenters/auther/account.rb', line 11 def login @login end |
#name ⇒ Object
Returns the value of attribute name.
11 12 13 |
# File 'app/presenters/auther/account.rb', line 11 def name @name end |
#password ⇒ Object
Returns the value of attribute password.
11 12 13 |
# File 'app/presenters/auther/account.rb', line 11 def password @password end |
Instance Method Details
#error?(key) ⇒ Boolean
21 |
# File 'app/presenters/auther/account.rb', line 21 def error?(key) = errors.key? key |
#error_message(key) ⇒ Object
23 24 25 26 27 |
# File 'app/presenters/auther/account.rb', line 23 def key return "" unless error? key "#{key.capitalize} #{errors.[key].first}" end |