This is a Ruby tree! It shows every object from the Ruby Programming Language in a tree format.
# Array.cycle (from ruby core) --- array.cycle {|element| ... } -> nil array.cycle(count) {|element| ... } -> nil array.cycle -> new_enumerator array.cycle(count) -> new_enumerator --- When called with positive Integer argument `count` and a block, calls the block with each element, then does so again, until it has done so `count` times; returns `nil`: output = [] [0, 1].cycle(2) {|element| output.push(element) } # => nil output # => [0, 1, 0, 1] If `count` is zero or negative, does not call the block: [0, 1].cycle(0) {|element| fail 'Cannot happen' } # => nil [0, 1].cycle(-1) {|element| fail 'Cannot happen' } # => nil When a block is given, and argument is omitted or `nil`, cycles forever: # Prints 0 and 1 forever. [0, 1].cycle {|element| puts element } [0, 1].cycle(nil) {|element| puts element } When no block is given, returns a new Enumerator: [0, 1].cycle(2) # => #<Enumerator: [0, 1]:cycle(2)> [0, 1].cycle # => # => #<Enumerator: [0, 1]:cycle> [0, 1].cycle.first(5) # => [0, 1, 0, 1, 0]
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.