Exception: RailsStuff::ParamsParser::Error
- Inherits:
-
StandardError
- Object
- StandardError
- RailsStuff::ParamsParser::Error
- Defined in:
- lib/rails_stuff/params_parser.rb
Overview
This exceptions is wrapper for any exception occured in parser. Original exception message can be retrieved with ‘original_message` method.
Instance Attribute Summary collapse
-
#original_message ⇒ Object
readonly
Returns the value of attribute original_message.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#exception ⇒ Object
Keeps message when passing instance to ‘raise`.
-
#initialize(original_message = nil, value = nil) ⇒ Error
constructor
A new instance of Error.
-
#to_s ⇒ Object
Show original messages in tests.
Constructor Details
#initialize(original_message = nil, value = nil) ⇒ Error
Returns a new instance of Error.
26 27 28 29 30 31 |
# File 'lib/rails_stuff/params_parser.rb', line 26 def initialize( = nil, value = nil) = "Error while parsing: #{value.inspect}" @original_message = || @value = value super() end |
Instance Attribute Details
#original_message ⇒ Object (readonly)
Returns the value of attribute original_message.
24 25 26 |
# File 'lib/rails_stuff/params_parser.rb', line 24 def @original_message end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
24 25 26 |
# File 'lib/rails_stuff/params_parser.rb', line 24 def value @value end |
Instance Method Details
#exception ⇒ Object
Keeps message when passing instance to ‘raise`.
34 35 36 |
# File 'lib/rails_stuff/params_parser.rb', line 34 def exception(*) self end |
#to_s ⇒ Object
Show original messages in tests.
39 40 41 |
# File 'lib/rails_stuff/params_parser.rb', line 39 def to_s "#{super} (#{})" end |