--- !ruby/object:RI::MethodDescription
aliases: []
block_params:
comment:
- !ruby/struct:SM::Flow::P
body: Iterates over rng, passing each nth element to the block. If the range contains numbers, n is added for each iteration. Otherwise step invokes succ to iterate through range elements. The following code uses class Xs, which is defined in the class-level documentation.
- !ruby/struct:SM::Flow::VERB
body: " range = Xs.new(1)..Xs.new(10)\n range.step(2) {|x| puts x}\n range.step(3) {|x| puts x}\n"
- !ruby/struct:SM::Flow::P
body: produces:
- !ruby/struct:SM::Flow::VERB
body: " 1 x\n 3 xxx\n 5 xxxxx\n 7 xxxxxxx\n 9 xxxxxxxxx\n 1 x\n 4 xxxx\n 7 xxxxxxx\n 10 xxxxxxxxxx\n"
full_name: Range#step
is_singleton: false
name: step
params: |
rng.step(n=1) {| obj | block } => rng
visibility: public