るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Enumerator.new(size=nil) {|y| ... } -> Enumerator (35273.0)

Enumerator オブジェクトを生成して返します。与えられたブロックは Enumerator::Yielder オブジェクトを 引数として実行されます。

...
Enumerator
オブジェクトを生成して返します。与えられたブロックは Enumerator::Yielder オブジェクトを
引数として実行されます。

生成された Enumerator オブジェクトに対して each を呼ぶと、この生成時に指定されたブロックを...
...し、Yielder オブジェクトに対して << メソッドが呼ばれるたびに、
e
ach に渡されたブロックが繰り返されます。

new に渡されたブロックが終了した時点で each の繰り返しが終わります。
このときのブロックの返り値が each の...
...ize 生成する Enumerator オブジェクトの要素数を指定します。
Integer、Float::INFINITY、Proc オブジェク
ト、nil のいずれかを指定します。Enumerator#size の実
行時に参照されます。

//emlist[例][ruby]{
e
num = Enumer...

Enumerator.produce(initial = nil) { |prev| ... } -> Enumerator (35273.0)

与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。 ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。 initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロック 呼び出しの引数として渡されます。initial が渡されなかった場合は nil が 渡されます。

...与えられたブロックを呼び出し続ける、停止しない Enumerator を返します。
ブロックの戻り値が、次にブロックを呼び出す時に引数として渡されます。
initial 引数が渡された場合、最初にブロックを呼び出す時にそれがブロ...
...が例外 StopIterationを投げた場合、繰り返しが終了します。

@param initial ブロックに最初に渡される値です。任意のオブジェクトを渡せます。

//emlist[例][ruby]{
# 1, 2, 3, 4, ... と続く Enumerator
Enumerator
.produce(1, &:succ)

# next を呼ぶた...
... Enumerator
Enumerator
.produce { rand(10) }

# ツリー構造の祖先ノードを列挙する Enumerator
ancestors = Enumerator.produce(node) { |prev| node = prev.parent or raise StopIteration }
e
nclosing_section = ancestors.find { |n| n.type == :section }
//}

このメソッドは Enumerable...

Enumerator.new(size=nil) {|y| ... } -> Enumerator (35271.0)

Enumerator オブジェクトを生成して返します。与えられたブロックは Enumerator::Yielder オブジェクトを 引数として実行されます。

...
Enumerator
オブジェクトを生成して返します。与えられたブロックは Enumerator::Yielder オブジェクトを
引数として実行されます。

生成された Enumerator オブジェクトに対して each を呼ぶと、この生成時に指定されたブロックを...
...し、Yielder オブジェクトに対して << メソッドが呼ばれるたびに、
e
ach に渡されたブロックが繰り返されます。

new に渡されたブロックが終了した時点で each の繰り返しが終わります。
このときのブロックの返り値が each の...
...ize 生成する Enumerator オブジェクトの要素数を指定します。
Integer、Float::INFINITY、Proc オブジェク
ト、nil のいずれかを指定します。Enumerator#size の実
行時に参照されます。

//emlist[例][ruby]{
e
num = Enumer...

Enumerator.new(obj, method = :each, *args) -> Enumerator (35218.0)

オブジェクト obj について、 each の代わりに method という 名前のメソッドを使って繰り返すオブジェクトを生成して返します。 args を指定すると、 method の呼び出し時に渡されます。

... each の代わりに method という
名前のメソッドを使って繰り返すオブジェクトを生成して返します。
args を指定すると、 method の呼び出し時に渡されます。

@param obj イテレータメソッドのレシーバとなるオブジェクト
@param meth...
...od イテレータメソッドの名前を表すシンボルまたは文字列
@param args イテレータメソッドの呼び出しに渡す任意個の引数

//emlist[例][ruby]{
str = "xyz"

e
num = Enumerator.new(str, :each_byte)
p enum.map {|b| '%02x' % b } # => ["78", "79", "7a"]
//}...

Enumerator::ArithmeticSequence#==(other) -> bool (35202.0)

Enumerable::ArithmeticSequence として等しいか判定します。

...
E
numerable::ArithmeticSequence として等しいか判定します。

other が Enumerable::ArithmeticSequence
begin, end, step, exclude_end? が等しい時に
true を返します。

@param other 自身と比較する Enumerable::ArithmeticSequence...

絞り込み条件を変える

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

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

...
E
numerable#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#slice_after {|elt| bool } -> Enumerator::Lazy (17280.0)

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

...
E
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 }.tak...
...e(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(pattern) -> Enumerator::Lazy (17280.0)

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

...
E
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 }.tak...
...e(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 (17269.0)

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

...
E
numerable#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 }.t...
...ake(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 (17269.0)

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

...
E
numerable#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 }.t...
...ake(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 (17269.0)

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

...
E
numerable#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 }.t...
...ake(5).force
# => [[1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11], [12, 13, 14]]
//}

@see Enumerable#slice_before...

Enumerator::Lazy#collect {|item| ... } -> Enumerator::Lazy (17244.0)

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

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

@raise ArgumentError ブロックを指定しなかった場合に発生します。

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

1.step.lazy.collect{ |n| n.succ }.take(10).force
# => [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
//}

@see Enumerable#map...
<< 1 2 3 ... > >>