123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::Tryable

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: activesupport/lib/active_support/core_ext/object/try.rb

Instance Method Summary

Instance Method Details

#try(*args, &block)

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/object/try.rb', line 7

def try(*args, &block)
  if args.empty? && block_given?
    if block.arity == 0
      instance_eval(&block)
    else
      yield self
    end
  elsif respond_to?(args.first)
    public_send(*args, &block)
  end
end

#try!(*args, &block)

[ GitHub ]

  
# File 'activesupport/lib/active_support/core_ext/object/try.rb', line 20

def try!(*args, &block)
  if args.empty? && block_given?
    if block.arity == 0
      instance_eval(&block)
    else
      yield self
    end
  else
    public_send(*args, &block)
  end
end