Class: Auther::Presenter::Account

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
app/presenters/auther/account.rb

Overview

Adapter for presenting an account within a view.

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = 
  @password = password
end

Instance Attribute Details

#loginObject

Returns the value of attribute login.



11
12
13
# File 'app/presenters/auther/account.rb', line 11

def 
  @login
end

#nameObject

Returns the value of attribute name.



11
12
13
# File 'app/presenters/auther/account.rb', line 11

def name
  @name
end

#passwordObject

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

Returns:

  • (Boolean)


21
22
23
# File 'app/presenters/auther/account.rb', line 21

def error? key
  errors.key? key
end

#error_message(key) ⇒ Object



25
26
27
28
# File 'app/presenters/auther/account.rb', line 25

def error_message key
  return "" unless error?(key)
  "#{key.capitalize} #{errors.messages[key].first}"
end