rubyguides

Reference

Core Classes

Reference pages for Ruby core classes and constructors.

  1. BasicObject#method_missing

    BasicObject#method_missing intercepts undefined methods for dynamic delegation, fluent interfaces, and small DSLs in Ruby.

  2. Binding

    A Binding captures Ruby's execution context — local variables, self, and method scope — so you can evaluate code later in that same environment.

  3. Float

    The Float class represents IEEE 754 double-precision numbers in Ruby. Create and convert floating-point values while avoiding precision pitfalls and Infinity.

  4. Integer

    Ruby's integer class handles whole numbers of any size. Covers arithmetic, bit ops, type conversion, iteration with times and step, and practical patterns.

  5. Kernel#block_given?

    Kernel#block_given? checks if a block was passed to the current method. Write Ruby methods that adapt when a block is present or absent with this simple guard.

  6. Object#clone

    Clone creates a shallow copy of an object in Ruby, preserving frozen status, singleton methods, and instance variables. Learn how clone differs from dup.

  7. Object#dup

    Object#dup creates a shallow copy of a Ruby object, preserving instance variables but not the singleton class. A key tool for defensive copying in Ruby.

  8. Object#frozen?

    Returns true if the object is frozen, false otherwise. Frozen objects cannot be modified, which helps with immutability and shared data.

  9. Object#instance_of?

    Returns true if the object is an instance of exactly the given class, not its superclasses. Use it when a strict class check matters more than inheritance.

  10. Object#is_a?

    Object#is_a? checks if an object is an instance of a class or any ancestor. Covers type checking, module matching, guard clauses, and dispatch patterns.

  11. Object#kind_of?

    Ruby's Object#kind_of? method returns true if an object is an instance of the given class, module, or any ancestor in the inheritance chain. Alias for is_a?.

  12. 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.

  13. Object#object_id

    Returns a unique integer identifier for a Ruby object. This integer is the object's memory address in the MRI implementation.

  14. 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.

  15. Object#send

    Invokes the named method on the object, passing any arguments. send is the foundation for dynamic method calls in Ruby.

  16. Object#tap

    Object#tap yields the receiver to a block and returns the object itself, making it perfect for debugging method chains and inline configuration in Ruby.

  17. Object#try

    Safely call a method on an object if it responds to it, and return nil otherwise. Useful for nil-safe chaining in Rails code.

  18. String#chomp!

    String#chomp! removes trailing separators from a string in place. It mutates the receiver, returns self when it trims text, and nil when nothing is removed.