module ActiveSupport::Tryable
def try(*args, &block)
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
def try!(*args, &block)
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