This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.

[]

        # Integer.[]

(from ruby core)
---
    self[offset]    -> 0 or 1
    self[offset, size] -> integer
    self[range] -> integer

---

Returns a slice of bits from `self`.

With argument `offset`, returns the bit at the given offset, where
offset 0 refers to the least significant bit:

    n = 0b10 # => 2
    n[0]     # => 0
    n[1]     # => 1
    n[2]     # => 0
    n[3]     # => 0

In principle, `n[i]` is equivalent to `(n >> i) & 1`. Thus, negative
index always returns zero:

    255[-1] # => 0

With arguments `offset` and `size`, returns `size` bits from `self`,
beginning at `offset` and including bits of greater significance:

    n = 0b111000       # => 56
    "%010b" % n[0, 10] # => "0000111000"
    "%010b" % n[4, 10] # => "0000000011"

With argument `range`, returns `range.size` bits from `self`, beginning
at `range.begin` and including bits of greater significance:

    n = 0b111000      # => 56
    "%010b" % n[0..9] # => "0000111000"
    "%010b" % n[4..9] # => "0000000011"

Raises an exception if the slice cannot be constructed.



      

This is MURDOC! A Ruby documentation browser inspired by Smalltalk-80. It allows you to learn about Ruby by browsing through its class hierarchies, and see any of its methods.