Class: Object

Inherits:
BasicObject
Defined in:
lib/camt/object_extension.rb

Instance Method Summary collapse

Instance Method Details

#try(*a, &b) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/camt/object_extension.rb', line 3

def try(*a, &b)
  if a.empty? && block_given?
    yield self
  else
    public_send(*a, &b) if respond_to?(a.first)
  end
end