Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/core_ext/object.rb
Instance Method Summary collapse
-
#try(method) ⇒ Object
@person ? @person.name : nil vs @person.try(:name).
Instance Method Details
#try(method) ⇒ Object
@person ? @person.name : nil vs
@person.try(:name)
6 7 8 |
# File 'lib/core_ext/object.rb', line 6 def try(method) send method if respond_to? method end |