Class: Dawn::SafeExtension::SafeContext
- Inherits:
-
Object
- Object
- Dawn::SafeExtension::SafeContext
- Defined in:
- lib/dawn/api/safe/safe_extension.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#last_exception ⇒ Object
Returns the value of attribute last_exception.
Instance Method Summary collapse
-
#initialize(obj) ⇒ SafeContext
constructor
A new instance of SafeContext.
-
#method_missing(sym, *args, &block) ⇒ Object
:nodoc:.
Constructor Details
#initialize(obj) ⇒ SafeContext
Returns a new instance of SafeContext.
10 11 12 13 |
# File 'lib/dawn/api/safe/safe_extension.rb', line 10 def initialize(obj) @obj = obj @last_exception = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
:nodoc:
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dawn/api/safe/safe_extension.rb', line 16 def method_missing(sym, *args, &block) if @obj.respond_to?(sym) begin @obj.send sym, *args, &block rescue => ex self.last_exception = ex false end else @obj.method_missing sym, *args, &block end end |
Instance Attribute Details
#last_exception ⇒ Object
Returns the value of attribute last_exception.
5 6 7 |
# File 'lib/dawn/api/safe/safe_extension.rb', line 5 def last_exception @last_exception end |