Class: Fuby::Try::Base
- Inherits:
- BasicObject
- Defined in:
- lib/fuby/try.rb
Instance Method Summary collapse
- #__unwrap__ ⇒ Object
- #__wrap__(result) ⇒ Object
-
#initialize(object, maybe = nil) ⇒ Base
constructor
A new instance of Base.
- #method_missing(key, *sig, &blk) ⇒ Object
Constructor Details
#initialize(object, maybe = nil) ⇒ Base
Returns a new instance of Base.
37 38 39 40 41 |
# File 'lib/fuby/try.rb', line 37 def initialize object, maybe = nil @object = object @maybe = maybe @class = (class << self; self end).superclass end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key, *sig, &blk) ⇒ Object
43 44 45 46 |
# File 'lib/fuby/try.rb', line 43 def method_missing key, *sig, &blk return __wrap__ @object.send key, *sig, &blk if @object.respond_to? key return __wrap__ nil end |