Class: InvalidModel::Error
- Inherits:
-
Object
- Object
- InvalidModel::Error
- Defined in:
- lib/invalid_model/error.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#errors_object ⇒ Object
readonly
Returns the value of attribute errors_object.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #detail ⇒ Object
-
#initialize(errors_object, attribute, type, meta) ⇒ Error
constructor
A new instance of Error.
- #model_name ⇒ Object
Constructor Details
#initialize(errors_object, attribute, type, meta) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 14 |
# File 'lib/invalid_model/error.rb', line 9 def initialize(errors_object, attribute, type, ) @errors_object = errors_object @attribute = attribute @type = type @meta = end |
Instance Attribute Details
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
7 8 9 |
# File 'lib/invalid_model/error.rb', line 7 def attribute @attribute end |
#errors_object ⇒ Object (readonly)
Returns the value of attribute errors_object.
7 8 9 |
# File 'lib/invalid_model/error.rb', line 7 def errors_object @errors_object end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
7 8 9 |
# File 'lib/invalid_model/error.rb', line 7 def @meta end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/invalid_model/error.rb', line 7 def type @type end |
Class Method Details
.from_hash(errors_object, attribute, hash) ⇒ Object
3 4 5 |
# File 'lib/invalid_model/error.rb', line 3 def self.from_hash(errors_object, attribute, hash) new(errors_object, attribute, hash[:error], hash.except(:error)) end |
Instance Method Details
#detail ⇒ Object
16 17 18 |
# File 'lib/invalid_model/error.rb', line 16 def detail @errors_object.(attribute, errors_object.(attribute, type, )) end |
#model_name ⇒ Object
20 21 22 |
# File 'lib/invalid_model/error.rb', line 20 def model_name errors_object.instance_variable_get(:@base).model_name end |