Class: ActiveForm::Error
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#element ⇒ Object
Returns the value of attribute element.
-
#msg ⇒ Object
(also: #message)
Returns the value of attribute msg.
Instance Method Summary collapse
- #identifier ⇒ Object
-
#initialize(element, msg, code = 'default', params = []) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(element, msg, code = 'default', params = []) ⇒ Error
Returns a new instance of Error.
7 8 9 10 |
# File 'lib/active_form/errors.rb', line 7 def initialize(element, msg, code = 'default', params = []) msg = element.(msg, code, params) self.element, self.msg, self.code = element, msg, code.to_s end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
5 6 7 |
# File 'lib/active_form/errors.rb', line 5 def code @code end |
#element ⇒ Object
Returns the value of attribute element.
5 6 7 |
# File 'lib/active_form/errors.rb', line 5 def element @element end |
#msg ⇒ Object Also known as: message
Returns the value of attribute msg.
5 6 7 |
# File 'lib/active_form/errors.rb', line 5 def msg @msg end |
Instance Method Details
#identifier ⇒ Object
14 15 16 |
# File 'lib/active_form/errors.rb', line 14 def identifier self.code == 'required' ? code : "validate-#{code}" end |