Class: ExceptionsHandler
- Defined in:
- lib/pry-byetypo/exceptions_handler.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#pry ⇒ Object
readonly
Returns the value of attribute pry.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(output, exception, pry) ⇒ ExceptionsHandler
constructor
A new instance of ExceptionsHandler.
Methods inherited from Base
Constructor Details
#initialize(output, exception, pry) ⇒ ExceptionsHandler
Returns a new instance of ExceptionsHandler.
13 14 15 16 17 |
# File 'lib/pry-byetypo/exceptions_handler.rb', line 13 def initialize(output, exception, pry) @output = output @exception = exception @pry = pry end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
11 12 13 |
# File 'lib/pry-byetypo/exceptions_handler.rb', line 11 def exception @exception end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
11 12 13 |
# File 'lib/pry-byetypo/exceptions_handler.rb', line 11 def output @output end |
#pry ⇒ Object (readonly)
Returns the value of attribute pry.
11 12 13 |
# File 'lib/pry-byetypo/exceptions_handler.rb', line 11 def pry @pry end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pry-byetypo/exceptions_handler.rb', line 19 def call case exception in NoMethodError Exceptions::NoMethodError.call(output, exception, pry) in NameError # NameError is a Superclass for all undefined statement. Exceptions::NameError::Handler.call(output, exception, pry) in ActiveRecord::StatementInvalid Exceptions::ActiveRecord::StatementInvalid::Handler.call(output, exception, pry) in ActiveRecord::ConfigurationError Exceptions::ActiveRecord::ConfigurationError.call(output, exception, pry) else pry_exception_handler end end |