るりまサーチ

最速Rubyリファレンスマニュアル検索!
98件ヒット [1-98件を表示] (0.203秒)

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

キーワード

検索結果

Range#step(s = 1) -> Enumerator (21436.0)

範囲内の要素を s おきに繰り返します。

...

@
param s 次のステップへ遷移するたびに加算されるものを指定します。
@
return ブロックを指定した時は self を返します。
@
return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@
return...
...他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}


非数値の Range で...
... Range で s に数値を指定した場合を除きます)

//emlist[数値以外の Range に対する例][ruby]{
# Time の Range は each でイテレートできない
(Time.utc(2024, 12, 25)...Time.utc(2024, 12, 26)).each { |t| p t }
# => 'Range#each': can't iterate from Time (TypeError)...

Range#step(s = 1) -> Enumerator::ArithmeticSequence (21436.0)

範囲内の要素を s おきに繰り返します。

...

@
param s 次のステップへ遷移するたびに加算されるものを指定します。
@
return ブロックを指定した時は self を返します。
@
return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@
return...
...他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}


非数値の Range で...
... Range で s に数値を指定した場合を除きます)

//emlist[数値以外の Range に対する例][ruby]{
# Time の Range は each でイテレートできない
(Time.utc(2024, 12, 25)...Time.utc(2024, 12, 26)).each { |t| p t }
# => 'Range#each': can't iterate from Time (TypeError)...

Range#step(s = 1) {|item| ... } -> self (21436.0)

範囲内の要素を s おきに繰り返します。

...

@
param s 次のステップへ遷移するたびに加算されるものを指定します。
@
return ブロックを指定した時は self を返します。
@
return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@
return...
...他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}


非数値の Range で...
... Range で s に数値を指定した場合を除きます)

//emlist[数値以外の Range に対する例][ruby]{
# Time の Range は each でイテレートできない
(Time.utc(2024, 12, 25)...Time.utc(2024, 12, 26)).each { |t| p t }
# => 'Range#each': can't iterate from Time (TypeError)...

Enumerator::Lazy#slice_after(pattern) -> Enumerator::Lazy (12337.0)

Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。

...numerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>

1.step.lazy.slice_after { |e| e % 3 == 0 }.take(...
...5).force
# => [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]
//}

@
see Enumerable#slice_after...

Enumerator::Lazy#slice_after {|elt| bool } -> Enumerator::Lazy (12237.0)

Enumerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。

...numerable#slice_after と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_after { |e| e % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007fd73980e6f8>:each>>

1.step.lazy.slice_after { |e| e % 3 == 0 }.take(...
...5).force
# => [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15]]
//}

@
see Enumerable#slice_after...

絞り込み条件を変える

Enumerator::Lazy#slice_before {|elt| bool } -> Enumerator::Lazy (9237.0)

Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

...umerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take...
...(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@
see Enumerable#slice_before...

Enumerator::Lazy#slice_before(initial_state) {|elt, state| bool } -> Enumerator::Lazy (9237.0)

Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

...umerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take...
...(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@
see Enumerable#slice_before...

Enumerator::Lazy#slice_before(pattern) -> Enumerator::Lazy (9237.0)

Enumerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

...umerable#slice_before と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_before { |e| e.even? }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007f9f31844ce8>:each>>

1.step.lazy.slice_before { |e| e % 3 == 0 }.take...
...(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@
see Enumerable#slice_before...

Enumerator::Lazy#slice_when {|elt_before, elt_after| bool } -> Enumerator::Lazy (6337.0)

Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。

...Enumerable#slice_when と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.slice_when { |i, j| (i + j) % 5 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x00007fce84118348>:each>>

1.step.lazy.slice_when { |i, j| (i +...
...j) % 5 == 0 }.take(5).force
# => [[1, 2], [3, 4, 5, 6, 7], [8, 9, 10, 11, 12], [13, 14, 15, 16, 17], [18, 19, 20, 21, 22]]
//}

@
see Enumerable#slice_when...

Enumerator::Lazy#chunk {|elt| ... } -> Enumerator::Lazy (6237.0)

Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

...Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[fa...
...lse, [1, 2]], [true, [3]], [false, [4, 5]], [true, [6]], [false, [7, 8]]]
//}

@
see Enumerable#chunk...

絞り込み条件を変える

Enumerator::Lazy#chunk(initial_state) {|elt, state| ... } -> Enumerator::Lazy (6237.0)

Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

...Enumerable#chunk と同じですが、配列ではなく Enumerator::Lazy を返します。

//emlist[例][ruby]{
1.step.lazy.chunk{ |n| n % 3 == 0 }
# => #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x007f8bf18118f0>:each>>

1.step.lazy.chunk{ |n| n % 3 == 0 }.take(5).force
# => [[fa...
...lse, [1, 2]], [true, [3]], [false, [4, 5]], [true, [6]], [false, [7, 8]]]
//}

@
see Enumerable#chunk...

Range#%(s) -> Enumerator (3336.0)

範囲内の要素を s おきに繰り返します。

...

@
param s 次のステップへ遷移するたびに加算されるものを指定します。
@
return ブロックを指定した時は self を返します。
@
return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@
return...
...他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}


非数値の Range で...
... Range で s に数値を指定した場合を除きます)

//emlist[数値以外の Range に対する例][ruby]{
# Time の Range は each でイテレートできない
(Time.utc(2024, 12, 25)...Time.utc(2024, 12, 26)).each { |t| p t }
# => 'Range#each': can't iterate from Time (TypeError)...

Range#%(s) -> Enumerator::ArithmeticSequence (3336.0)

範囲内の要素を s おきに繰り返します。

...

@
param s 次のステップへ遷移するたびに加算されるものを指定します。
@
return ブロックを指定した時は self を返します。
@
return ブロックを指定しなかった時かつ数値の Range の時は Enumerator::ArithmeticSequence を返します。
@
return...
...他の Range の時は Enumerator を返します。(例: String の Range)

//emlist[例][ruby]{
(1..10).step(3) {|v| p v}
# => 1
# 4
# 7
# 10

("a".."f").step(2) {|v| p v}
# => "a"
# "c"
# "e"

(10..0).step(-3) {|v| p v}
# => 10
# 7
# 4
# 1
//}


非数値の Range で...
... Range で s に数値を指定した場合を除きます)

//emlist[数値以外の Range に対する例][ruby]{
# Time の Range は each でイテレートできない
(Time.utc(2024, 12, 25)...Time.utc(2024, 12, 26)).each { |t| p t }
# => 'Range#each': can't iterate from Time (TypeError)...