るりまサーチ

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

別のキーワード

  1. openssl value
  2. rss value
  3. rss value=
  4. rexml/document value
  5. _builtin each_value

検索結果

<< 1 2 3 ... > >>

CGI::QueryExtension::Value#[](idx, *args) (21100.0)

@todo

@todo

Hash.[](*key_and_value) -> Hash (18211.0)

新しいハッシュを生成します。 引数は必ず偶数個指定しなければなりません。奇数番目がキー、偶数番目が値になります。

...ォルト値を指定することはできません。
Hash.newを使うか、Hash#default=で後から指定してください。

@param key_and_value 生成するハッシュのキーと値の組です。必ず偶数個(0を含む)指定しなければいけません。
@raise ArgumentError 奇...
...す。

(1) [キー, 値, ...] の配列からハッシュへ

//emlist[][ruby]{
ary = [1,"a", 2,"b", 3,["c"]]
p Hash[*ary] # => {1=>"a", 2=>"b", 3=>["c"]}
//}

(2) キーと値のペアの配列からハッシュへ

//emlist[][ruby]{
alist = [[1,"a"], [2,"b"], [3,["c"]]]
p alist.flatten(1) # => [...
...ュへ

//emlist[][ruby]{
keys = [1, 2, 3]
vals = ["a", "b", ["c"]]
alist = keys.zip(vals) # あるいは alist = [keys,vals].transpose
p alist # => [[1, "a"], [2, "b"], [3, ["c"]]]
p Hash[alist] # => {1=>"a", 2=>"b", 3=>["c"]}
//}

(4) キーや値が配列の場合

//emlist[][ruby]{
alist =...

Hash.[](other) -> Hash (18126.0)

新しいハッシュを生成します。 引数otherと同一のキーと値を持つ新たなハッシュを生成して返します。

...//emlist[][ruby]{
h = {1 => "value"}
h.default = "none"

g = Hash[h]
p g #=> {1=>"value"}

p h[:no] #=> "none"
p g[:no] #=> nil

h[:add] = "some"
p h #=> {1=>"value", :add=>"some"}
p g #=> {1=>"value"}

h[1] << 'plus' #破壊的操作
p h #=> {1=>"valueplus", :add=>"some"}
p g #=> {1=>"valueplus"}
/...

Rake::TaskArguments#[](key) -> object (18124.0)

与えられたパラメータ名に対応する値を返します。

...の名前を指定します。

//emlist[][ruby]{
# Rakefile での記載例とする

task default: :test_rake_app
task :test_rake_app do
arguments = Rake::TaskArguments.new(["name1", "name2"], ["value1", "value2"])
arguments["name1"] # => "value1"
arguments["name2"] # => "value2"
end
//}...

Thread#value -> object (18119.0)

スレッド self が終了するまで待ち(Thread#join と同じ)、 そのスレッドのブロックが返した値を返します。スレッド実行中に例外が 発生した場合には、その例外を再発生させます。

...結果を出力する例です。

threads = []
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })
threads.push(Thread.new { n = rand(5); sleep n; n })

threads.each {|t| p t.value}

最後の行で、待ち合わせを行って...
...いることがわかりにくいと思うなら以下
のように書くこともできます。

threads.each {|t| p t.join.value}...

絞り込み条件を変える

JSON::State#[](name) -> object (18116.0)

Return the value returned by method name.

...Return the value returned by method name....

Hash#[](key) -> object | nil (18112.0)

key に関連づけられた値を返します。

..."all"}
p h[:ab] #=> "some"
p h[:ef] #=> nil

h1 = Hash.new("default value")
p h1[:non] #=> "default value"

h2 = Hash.new {|*arg| arg}
p h2[:non] #=> [{}, :non]
//}

@see Hash.new, Hash#fetch,Hash#values_at,Hash#key?, Hash#default, Hash#default_proc...

Win32::Registry#[](name, wtype = nil) (18112.0)

@todo

...@todo

レジストリ値 name に value を書き込みます。

オプション引数 wtype を指定した場合は,その型で書き込みます。
指定しなかった場合,value のクラスに応じて次の型で書き込みます:
* Integer
REG_DWORD
* String
REG_SZ
*...

Rinda::TupleEntry#[](key) (18106.0)

タプルの key に対応する要素を返します。

...タプルの key に対応する要素を返します。

Rinda::TupleEntry#value[key] を返します。

@param key 要素を指定するキー

@see Rinda::TupleEntry#fetch...

Thread#[](name) -> object | nil (18106.0)

name に対応したスレッドに固有のデータを取り出します。 name に対応するスレッド固有データがなければ nil を返し ます。

...>: C
//}

Thread#[] と Thread#[]= を用いたスレッド固有の変数は
Fiber を切り替えると異なる変数を返す事に注意してください。

//emlist[][ruby]{
def meth(newvalue)
begin
oldvalue = Thread.current[:name]
Thread.current[:name] = newvalue
yield
ensu...
...re
Thread.current[:name] = oldvalue
end
end
//}

この関数に与えるブロックがFiberを切り替える場合は動的スコープとしては
正しく動作しません。

//emlist[][ruby]{
f = Fiber.new {
meth(1) {
Fiber.yield
}
}
meth(2) {
f.resume
}
f.resume
p Thread.cu...
...rrent[:name]
# => nil if fiber-local
# => 2 if thread-local (The value 2 is leaked to outside of meth method.)
//}

Fiber を切り替えても同じ変数を返したい場合は
Thread#thread_variable_get と Thread#thread_variable_set
を使用してください。

@see Thread#fetch, Thread#[]=...

絞り込み条件を変える

<< 1 2 3 ... > >>