Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/daiku/core_ext.rb
Instance Method Summary collapse
Instance Method Details
#try(*a, &b) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/daiku/core_ext.rb', line 4 def try(*a, &b) if a.empty? && block_given? yield self else public_send(*a, &b) if respond_to?(a.first) end end |
#try!(*a, &b) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/daiku/core_ext.rb', line 12 def try!(*a, &b) if a.empty? && block_given? yield self else public_send(*a, &b) end end |