541件ヒット
[1-100件を表示]
(0.136秒)
種類
- インスタンスメソッド (354)
- 特異メソッド (84)
- 文書 (67)
- ライブラリ (36)
クラス
- Array (12)
-
CSV
:: Table (60) - Enumerator (36)
-
Enumerator
:: Lazy (12) - Hash (156)
- MatchData (12)
- Matrix (12)
-
Rake
:: TaskArguments (12) - Regexp (24)
-
Resolv
:: DNS (12) - Struct (90)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) -
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (9) - [] (24)
-
bigdecimal
/ newton (12) - deconstruct (6)
-
delete
_ if (24) - diagonal (12)
- each (24)
-
fetch
_ values (20) - keys (12)
- match (24)
-
net
/ http (12) - new (60)
-
next
_ values (12) - peek (12)
-
peek
_ values (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) - timeouts= (12)
-
to
_ a (24) -
transform
_ keys (20) -
transform
_ keys! (20) -
transform
_ values (18) -
transform
_ values! (18) -
values
_ at (60) - yaml (12)
検索結果
先頭5件
-
Struct
# values -> [object] (21207.0) -
構造体のメンバの値を配列にいれて返します。
...列にいれて返します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345).to_a
# => ["Joe Smith", "123 Maple, Anytown NC", 12345]
//}
[注意] 本メソッドの記述は Struct の下位クラスのインスタンス......に対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
@see d:spec/pattern_matching#matching_non_primitive_objects... -
Hash
# values -> [object] (18213.0) -
ハッシュの全値の配列を返します。
...ハッシュの全値の配列を返します。
//emlist[例][ruby]{
h1 = { "a" => 100, 2 => ["some"], :c => "c" }
p h1.values #=> [100, ["some"], "c"]
//}
@see Hash#keys,Hash#to_a... -
Struct
# values -> [object] (18207.0) -
構造体のメンバの値を配列にいれて返します。
...列にいれて返します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345).to_a
# => ["Joe Smith", "123 Maple, Anytown NC", 12345]
//}
[注意] 本メソッドの記述は Struct の下位クラスのインスタンス......に対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。... -
Array
# values _ at(*selectors) -> Array (12255.0) -
引数で指定されたインデックスに対応する要素を配列で返します。インデッ クスに対応する値がなければ nil が要素になります。
...。
@param selectors インデックスを整数もしくは整数の Range で指定します。
//emlist[例][ruby]{
ary = %w( a b c d e )
p ary.values_at( 0, 2, 4 ) #=> ["a", "c", "e"]
p ary.values_at( 3, 4, 5, 6, 35 ) #=> ["d", "e", nil, nil, nil]
p ary.values_at( 0, -1, -2 )......> ["a", "e", "d"]
p ary.values_at( -4, -5, -6, -35 ) #=> ["b", "a", nil, nil]
p ary.values_at( 1..2 ) #=> ["b", "c"]
p ary.values_at( 3..10 ) #=> ["d", "e", nil, nil, nil, nil, nil, nil]
p ary.values_at( 6..7 ) #=> [nil, nil]
p ary.values_at( 0, 3..5 ) #=... -
Enumerator
# next _ values -> Array (12255.0) -
「次」のオブジェクトを配列で返します。
...トを配列で返します。
Enumerator#next とほぼ同様の挙動をします。終端まで到達した場合は
StopIteration 例外を発生させます。
このメソッドは、
yield
と
yield nil
を区別するために使えます。
next メソッドによる外部列挙の....../emlist[例: next と next_values の違いを][ruby]{
o = Object.new
def o.each
yield
yield 1
yield 1, 2
yield nil
yield [1, 2]
end
e = o.to_enum
p e.next_values
p e.next_values
p e.next_values
p e.next_values
p e.next_values
e = o.to_enum
p e.next
p e.next
p e.next
p e.next
p e.next
##......yield args next_values next
# yield [] nil
# yield 1 [1] 1
# yield 1, 2 [1, 2] [1, 2]
# yield nil [nil] nil
# yield [1, 2] [[1, 2]] [1, 2]
//}
@raise StopIteration 列挙状態が既に最... -
Hash
# transform _ values! -> Enumerator (12238.0) -
すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。
...@return transform_values! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values! {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform......_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}
@see Hash#transform_values......_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}
@see Hash#transform_values
@see Hash#transform_keys
@see Hash#transform_keys!... -
Hash
# transform _ values! {|value| . . . } -> self (12238.0) -
すべての値に対してブロックを呼び出した結果でハッシュの値を変更します。 キーは変化しません。
...@return transform_values! は常に self を返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values! {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform......_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}
@see Hash#transform_values......_values!(&:to_s) #=> { a: "2", b: "5", c: "10" }
h.transform_values!.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "2.0", b: "5.1", c: "10.2" }
//}
@see Hash#transform_values
@see Hash#transform_keys
@see Hash#transform_keys!... -
MatchData
# values _ at(*index) -> [String] (12237.0) -
正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。
...t[例][ruby]{
m = /(foo)(bar)(baz)/.match("foobarbaz")
# same as m.to_a.values_at(...)
p m.values_at(0, 1, 2, 3, 4) # => ["foobarbaz", "foo", "bar", "baz", nil]
p m.values_at(-1, -2, -3, -4, -5) # => ["baz", "bar", "foo", nil, nil]
m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
m.t......o_a # => ["1 + 2", "1", "+", "2"]
m.values_at(:a, :b, :op) # => ["1", "2", "+"]
//}
@see Array#values_at, Array#[]... -
Hash
# fetch _ values(key , . . . ) -> [object] (12232.0) -
引数で指定されたキーに関連づけられた値の配列を返します。
...ると発生します。
//emlist[例][ruby]{
h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" }
h.fetch_values("cow", "cat") # => ["bovine", "feline"]
h.fetch_values("cow", "bird") # raises KeyError
h.fetch_values("cow", "bird") { |k| k.upcase } # =......> ["bovine", "BIRD"]
//}
@see Hash#values_at, Hash#fetch... -
Hash
# fetch _ values(key , . . . ) { |key| . . . } -> [object] (12232.0) -
引数で指定されたキーに関連づけられた値の配列を返します。
...ると発生します。
//emlist[例][ruby]{
h = { "cat" => "feline", "dog" => "canine", "cow" => "bovine" }
h.fetch_values("cow", "cat") # => ["bovine", "feline"]
h.fetch_values("cow", "bird") # raises KeyError
h.fetch_values("cow", "bird") { |k| k.upcase } # =......> ["bovine", "BIRD"]
//}
@see Hash#values_at, Hash#fetch... -
Hash
# transform _ values -> Enumerator (12232.0) -
すべての値に対してブロックを呼び出した結果で置き換えたハッシュを返します。 キーは変化しません。
...eturn 置き換えたハッシュを返します。
ブロックが与えられなかった場合は、Enumerator オブジェクトを
返します。
//emlist[例][ruby]{
h = { a: 1, b: 2, c: 3 }
h.transform_values {|v| v * v + 1 } #=> { a: 2, b: 5, c: 10 }
h.transform_values(&:t......o_s) #=> { a: "1", b: "2", c: "3" }
h.transform_values.with_index {|v, i| "#{v}.#{i}" }
#=> { a: "1.0", b: "2.1", c: "3.2" }
//}
@see Hash#transform_values!
@see Hash#transform_keys
@see Hash#transform_keys!...