Class: Object

Inherits:
BasicObject
Defined in:
lib/blend/core_ext/object.rb

Instance Method Summary collapse

Instance Method Details

#try(*a, &b) ⇒ Object

Coped from activesupport because it’s useful but doesn’t justify pulling in activesupport dependencies:



5
6
7
8
9
10
11
# File 'lib/blend/core_ext/object.rb', line 5

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