Class: SimpleRecord::Error
- Inherits:
-
Object
- Object
- SimpleRecord::Error
- Defined in:
- lib/simple_record/errors.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#base ⇒ Object
Returns the value of attribute base.
-
#message ⇒ Object
(also: #to_s)
Returns the value of attribute message.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #full_message ⇒ Object
- #generate_full_message(options = {}) ⇒ Object
- #generate_message(options = {}) ⇒ Object
-
#initialize(base, attribute, message, options = {}) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(base, attribute, message, options = {}) ⇒ Error
Returns a new instance of Error.
24 25 26 27 28 |
# File 'lib/simple_record/errors.rb', line 24 def initialize(base, attribute, , = {}) self.base = base self.attribute = attribute self. = end |
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute.
22 23 24 |
# File 'lib/simple_record/errors.rb', line 22 def attribute @attribute end |
#base ⇒ Object
Returns the value of attribute base.
22 23 24 |
# File 'lib/simple_record/errors.rb', line 22 def base @base end |
#message ⇒ Object Also known as: to_s
Returns the value of attribute message.
22 23 24 |
# File 'lib/simple_record/errors.rb', line 22 def @message end |
#options ⇒ Object
Returns the value of attribute options.
22 23 24 |
# File 'lib/simple_record/errors.rb', line 22 def @options end |
#type ⇒ Object
Returns the value of attribute type.
22 23 24 |
# File 'lib/simple_record/errors.rb', line 22 def type @type end |
Instance Method Details
#full_message ⇒ Object
36 37 38 |
# File 'lib/simple_record/errors.rb', line 36 def attribute.to_s == 'base' ? : () end |
#generate_full_message(options = {}) ⇒ Object
46 47 48 |
# File 'lib/simple_record/errors.rb', line 46 def ( = {}) "#{attribute.to_s} #{}" end |
#generate_message(options = {}) ⇒ Object
42 43 44 |
# File 'lib/simple_record/errors.rb', line 42 def ( = {}) @message end |