Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/babushka/core_patches/try.rb,
lib/babushka/core_patches/object.rb
Overview
The implementation of #try as found in activesupport:
lib/active_support/core_ext/object/try.rb
Try is just a nil-swallowing send, which means return nil when called on nil and just send like normal when called on any other object.
Instance Method Summary (collapse)
-
- (Object) metaclass
Return this object's metaclass; i.e.
- - (Object) tap {|_self| ... }
-
- (Object) tapp
Return self unmodified after logging the output of #inspect, along with the point at which tapp was called.
Instance Method Details
- (Object) metaclass
Return this object's metaclass; i.e. the value of self within a 'class << self' block.
6 7 8 |
# File 'lib/babushka/core_patches/object.rb', line 6 def class << self; self end end |
- (Object) tap {|_self| ... }
17 18 19 20 |
# File 'lib/babushka/core_patches/object.rb', line 17 def tap &block yield self self end |
- (Object) tapp
Return self unmodified after logging the output of #inspect, along with the point at which tapp was called.
24 25 26 |
# File 'lib/babushka/core_patches/object.rb', line 24 def tapp tap { puts "#{File.basename caller[2]}: #{self.inspect}" } end |