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

step

        # Range.step

(from ruby core)
---
    step(n = 1) {|element| ... } -> self
    step(n = 1)                  -> enumerator

---

Iterates over the elements of `self`.

With a block given and no argument, calls the block each element of the
range; returns `self`:

    a = []
    (1..5).step {|element| a.push(element) } # => 1..5
    a # => [1, 2, 3, 4, 5]
    a = []
    ('a'..'e').step {|element| a.push(element) } # => "a".."e"
    a # => ["a", "b", "c", "d", "e"]

With a block given and a positive integer argument `n` given, calls the
block with element `0`, element `n`, element `2n`, and so on:

    a = []
    (1..5).step(2) {|element| a.push(element) } # => 1..5
    a # => [1, 3, 5]
    a = []
    ('a'..'e').step(2) {|element| a.push(element) } # => "a".."e"
    a # => ["a", "c", "e"]

With no block given, returns an enumerator, which will be of class
Enumerator::ArithmeticSequence if `self` is numeric; otherwise of class
Enumerator:

    e = (1..5).step(2) # => ((1..5).step(2))
    e.class            # => Enumerator::ArithmeticSequence
    ('a'..'e').step # => #<Enumerator: ...>

Related: Range#%.



      

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.