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
-
#metaclass ⇒ Object
Return this object’s metaclass; i.e.
-
#tapp ⇒ Object
Return self unmodified after logging the output of #inspect, along with the point at which
tappwas called. - #try(*args) ⇒ Object
Instance Method Details
#metaclass ⇒ Object
Return this object’s metaclass; i.e. the value of self within a ‘class << self’ block.
9 10 11 12 |
# File 'lib/babushka/core_patches/object.rb', line 9 def Babushka::LogHelpers.deprecated! '2017-09-01', instead: '`class << self; self end`' class << self; self end end |
#tapp ⇒ Object
Return self unmodified after logging the output of #inspect, along with the point at which tapp was called.
16 17 18 19 |
# File 'lib/babushka/core_patches/object.rb', line 16 def tapp Babushka::LogHelpers.deprecated! '2017-09-01' tap { STDOUT.puts "#{File.basename caller[2]}: #{self.inspect}" } end |
#try(*args) ⇒ Object
8 9 10 11 |
# File 'lib/babushka/core_patches/try.rb', line 8 def try(*args) Babushka::LogHelpers.deprecated! '2017-09-01' __send__(*args) end |