るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Set#filter! {|element| ... } -> self | nil (205.0)

各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。

各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。

@return 変更があった場合は self を、変更がなかった場合は nil を返します。

Set#select! {|element| ... } -> self | nil (205.0)

各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。

各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。

@return 変更があった場合は self を、変更がなかった場合は nil を返します。

Array#drop_while {|element| ... } -> Array (204.0)

ブロックを評価して最初に偽となった要素の手前の要素まで捨て、 残りの要素を配列として返します。 このメソッドは自身を破壊的に変更しません。

ブロックを評価して最初に偽となった要素の手前の要素まで捨て、
残りの要素を配列として返します。
このメソッドは自身を破壊的に変更しません。

ブロックを指定しなかった場合は、Enumerator を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]

# 変数aの値は変化しない
a # => [1, 2, 3, 4, 5, 0]
//}

@see Enumerable#drop_while, Array...

Array#take_while {|element| ... } -> Array (204.0)

配列の要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。 このメソッドは自身を破壊的に変更しません。

配列の要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。
このメソッドは自身を破壊的に変更しません。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Enumerable#take_while

Enumerable#drop_while {|element| ... } -> Array (204.0)

ブロックを評価して最初に偽となった要素の手前の要素まで捨て、 残りの要素を配列として返します。

ブロックを評価して最初に偽となった要素の手前の要素まで捨て、
残りの要素を配列として返します。

ブロックを指定しなかった場合は、Enumerator を返します。

//emlist[例][ruby]{
a = [1, 2, 3, 4, 5, 0]
a.drop_while {|i| i < 3 } # => [3, 4, 5, 0]
//}

絞り込み条件を変える

Enumerable#reverse_each {|element| ... } -> self (204.0)

逆順に各要素に対してブロックを評価します。

逆順に各要素に対してブロックを評価します。

内部で各要素を保持した配列を作ります。

ブロックを省略した場合は、各要素を逆順に辿る
Enumerator を返します。

//emlist[例][ruby]{
{a: 1, b: 2, c: 3}.reverse_each # => #<Enumerator: ...>
{a: 1, b: 2, c: 3}.reverse_each { |v| p v }
# => [:c, 3]
# [:b, 2]
# [:a, 1]
//}

Enumerable#take_while {|element| ... } -> Array (204.0)

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。 最初に偽になった要素の手前の要素までを配列として返します。

Enumerable オブジェクトの要素を順に偽になるまでブロックで評価します。
最初に偽になった要素の手前の要素までを配列として返します。

//emlist[例][ruby]{
e = [1, 2, 3, 4, 5, 0].each
e.take_while {|i| i < 3 } # => [1, 2]
//}

ブロックを省略した場合は Enumerator を返します。

@see Array#take_while

Range#reverse_each {|element| ... } -> self (204.0)

逆順に各要素に対してブロックを評価します。

逆順に各要素に対してブロックを評価します。

内部で各要素を保持した配列を作ります。ただし、端点が Integer である場合は、配列を作らないように最適化が行われています。

ブロックを省略した場合は、各要素を逆順に辿る
Enumerator を返します。

@raise TypeError 終端を持たない範囲オブジェクトに対してこのメソッドを呼んだ場合に発生します。

//emlist[例][ruby]{
(1..3).reverse_each # => #<Enumerator: ...>
(1..3).reverse_each { |v| p v }
# => 3
# 2
# ...

Set#keep_if {|element| ... } -> self (204.0)

各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。

各要素に対してブロックを評価し、その結果が偽であった要素を self から削除します。

@return 常に self を返します。

Module#ruby2_keywords(method_name, ...) -> nil (135.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...l hash argument is marked with a special
flag such that if it is the final element of a normal argument splat to
another method call, and that method call does not include explicit
keywords or a keyword splat, the final element is interpreted as
keywords. In other words, keywords will be passed thro...

絞り込み条件を変える

Proc#ruby2_keywords -> proc (135.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...l hash
argument is marked with a special flag such that if it is the final
element
of a normal argument splat to another method call, and that
method call does not include explicit keywords or a keyword splat, the
final element is interpreted as keywords. In other words, keywords will
be passed thr...
...so, be aware that if this method is removed, the behavior of the
proc will change so that it does not pass through keywords.

//emlist[][ruby]{
module Mod
foo = ->(meth, *args, &block) do
send(:"do_#{meth}", *args, &block)
end
foo.ruby2_keywords if foo.respond_to?(:ruby2_keywords)
end
//}...

Set#inspect -> String (127.0)

人間の読みやすい形に表現した文字列を返します。

...人間の読みやすい形に表現した文字列を返します。

//emlist[][ruby]{
puts Set.new(['element1', 'element2']).inspect
# => #<Set: {"element1", "element2"}>
//}...

Set#to_s -> String (127.0)

人間の読みやすい形に表現した文字列を返します。

...人間の読みやすい形に表現した文字列を返します。

//emlist[][ruby]{
puts Set.new(['element1', 'element2']).inspect
# => #<Set: {"element1", "element2"}>
//}...

Array#transpose -> Array (109.0)

自身を行列と見立てて、行列の転置(行と列の入れ換え)を行いま す。転置した配列を生成して返します。空の配列に対しては空の配列を生 成して返します。

...[5,6]].transpose
# => [[1, 3, 5], [2, 4, 6]]

p [].transpose
# => []

p [1,2,3].transpose

# => -:1:in `transpose': cannot convert Fixnum into Array (TypeError)
# from -:1

p [[1,2],
[3,4,5],
[6,7]].transpose
# => -:3:in `transpose': element size differ (3 should be 2) (IndexError)
//}...
<< 1 2 > >>