Core Classes
Reference pages for Ruby core classes and constructors.
Binding
An object that encapsulates the execution context, including local variables, self, and method scope.
Binding.new, binding() Float
A numeric class representing IEEE 754 double-precision floating-point numbers.
Float.new, Float() Integer
The core class for whole numbers, including Fixnum (smaller) and Bignum (larger) in older Ruby.
Integer() Kernel#block_given?
Returns true if a block was passed to the current method, otherwise returns false.
block_given? -> true or false Object#clone
Create a shallow copy of an object. clone copies both instance variables and singleton class.
obj.clone -> obj Object#dup
Create a shallow copy of an object. dup copies instance variables but not singleton methods.
obj.dup -> obj Object#frozen?
Returns true if the object is frozen (immutable), false otherwise. Frozen objects cannot be modified.
obj.frozen? -> true or false Object#instance_of?
Returns true if the object is an instance of exactly the given class, not its superclasses.
obj.instance_of?(klass) -> true or false Object#is_a?
Checks whether an object is an instance of a given class or any of its superclasses. Returns true or false.
obj.is_a?(klass) -> true or false Object#kind_of?
Returns true if the object is an instance of the given class or any of its superclasses.
obj.kind_of?(klass) -> true or false Object#nil?
The nil? method returns true if an object is nil, false otherwise. It's the standard way to check for nil values in Ruby.
obj.nil? -> true or false Object#object_id
Returns a unique integer identifier for a Ruby object. This integer is the object's memory address in the MRI implementation.
obj.object_id -> integer Object#respond_to?
Checks whether an object responds to a given method, returning true or false. Essential for duck typing and dynamic method handling in Ruby.
obj.respond_to?(method_name, include_all=false) -> true or false Object#send
Invokes the named method on the object, passing any arguments. send is the foundation for dynamic method calls in Ruby.
obj.send(symbol, *args) -> obj Object#tap
Yields the object to a block and returns the object itself, useful for debugging or method chaining.
obj.tap { |x| block } -> obj Object#try
Safely call a method on an object if it responds to it, returns nil otherwise
String#chomp!
Removes trailing record separators from a string in-place. Modifies the original string.
string.chomp! -> self or nil
string.chomp!(separator) -> self or nil