зеркало из https://github.com/github/ruby.git
[DOC] Modify descriptions for ArithmeticSequence
[ci-skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
1595421ce0
Коммит
98fa0ab4d9
|
@ -2654,9 +2654,11 @@ num_step_size(VALUE from, VALUE args, VALUE eobj)
|
|||
/*
|
||||
* call-seq:
|
||||
* num.step(by: step, to: limit) {|i| block } -> self
|
||||
* num.step(by: step, to: limit) -> an_enumerator
|
||||
* num.step(by: step, to: limit) -> an_enumerator
|
||||
* num.step(by: step, to: limit) -> an_arithmetic_sequence
|
||||
* num.step(limit=nil, step=1) {|i| block } -> self
|
||||
* num.step(limit=nil, step=1) -> an_enumerator
|
||||
* num.step(limit=nil, step=1) -> an_arithmetic_sequence
|
||||
*
|
||||
* Invokes the given block with the sequence of numbers starting at +num+,
|
||||
* incremented by +step+ (defaulted to +1+) on each call.
|
||||
|
@ -2685,6 +2687,8 @@ num_step_size(VALUE from, VALUE args, VALUE eobj)
|
|||
* and increments itself using the <code>+</code> operator.
|
||||
*
|
||||
* If no block is given, an Enumerator is returned instead.
|
||||
* Especially, the enumerator is an Enumerator::ArithmeticSequence
|
||||
* if both +limit+ and +step+ are kind of Numeric or <code>nil</code>.
|
||||
*
|
||||
* For example:
|
||||
*
|
||||
|
|
3
range.c
3
range.c
|
@ -353,6 +353,7 @@ range_step_size(VALUE range, VALUE args, VALUE eobj)
|
|||
* call-seq:
|
||||
* rng.step(n=1) {| obj | block } -> rng
|
||||
* rng.step(n=1) -> an_enumerator
|
||||
* rng.step(n=1) -> an_arithmetic_sequence
|
||||
*
|
||||
* Iterates over the range, passing each <code>n</code>th element to the block.
|
||||
* If begin and end are numeric, +n+ is added for each iteration.
|
||||
|
@ -360,6 +361,8 @@ range_step_size(VALUE range, VALUE args, VALUE eobj)
|
|||
* range elements.
|
||||
*
|
||||
* If no block is given, an enumerator is returned instead.
|
||||
* Especially, the enumerator is an Enumerator::ArithmeticSequence
|
||||
* if begin and end of the range are numeric.
|
||||
*
|
||||
* range = Xs.new(1)..Xs.new(10)
|
||||
* range.step(2) {|x| puts x}
|
||||
|
|
Загрузка…
Ссылка в новой задаче