Module: ActiveSupport::Try::Core

Defined in:
lib/dissociated_introspection/active_support.rb

Instance Method Summary collapse

Instance Method Details

#try(*a, &b) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/dissociated_introspection/active_support.rb', line 5

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