Module: Misfit::ClassMethods
- Defined in:
- lib/misfit.rb
Instance Method Summary collapse
- #exception(message = nil, *args) ⇒ Object
- #exception_class(klass = nil) ⇒ Object
- #new(message = nil, data = nil, *backtrace) ⇒ Object
-
#wrap(*args, &block) ⇒ Object
when called with an exception, makes the exception a <self> when called with a block, any exceptions raised in the block will be wrapped as <self>.
Instance Method Details
#exception(message = nil, *args) ⇒ Object
30 31 32 |
# File 'lib/misfit.rb', line 30 def exception = nil, *args new , nil, *args end |
#exception_class(klass = nil) ⇒ Object
34 35 36 37 |
# File 'lib/misfit.rb', line 34 def exception_class klass = nil @exception_class = klass if klass @exception_class end |
#new(message = nil, data = nil, *backtrace) ⇒ Object
26 27 28 |
# File 'lib/misfit.rb', line 26 def new = nil, data = nil, *backtrace wrap_exception exception_class.exception(, *backtrace), data end |
#wrap(*args, &block) ⇒ Object
when called with an exception, makes the exception a <self> when called with a block, any exceptions raised in the block will be wrapped as <self>
18 19 20 21 22 23 24 |
# File 'lib/misfit.rb', line 18 def wrap *args, &block if block wrap_block &block else wrap_exception *args end end |