class Object

Public Instance Methods

present?() click to toggle source
# File lib/object.rb, line 2
def present?
  ! nil?
end
to_a() click to toggle source
# File lib/object.rb, line 5
def to_a
  [ self ]
end
try( method_name = nil, *args ) { |self| ... } click to toggle source

stolen from activesupport core extensions

# File lib/object.rb, line 10
def try( method_name = nil, *args, &b )
  if method_name.nil? && block_given?
    b.arity == 0 ? instance_eval( &b ) : yield( self )
  elsif respond_to?( method_name )
    public_send( method_name, *args, &b )
  end
end