るりまサーチ

最速Rubyリファレンスマニュアル検索!
105件ヒット [1-100件を表示] (0.132秒)
トップページ > クエリ:I[x] > クエリ:fetch[x] > クエリ:[][x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. _builtin i
  5. csv to_i

ライブラリ

クラス

モジュール

検索結果

<< 1 2 > >>

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

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

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

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

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

@see Rinda::TupleEntry#fetch...

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

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

...としての nil を区別する必要が
ある場合は Hash#fetch または Hash#key? を使ってください。

@param key 探索するキーを指定します。

//emlist[例][ruby]{
h = {:ab => "some" , :cd => "all"}
p h[:ab] #=> "some"
p h[:ef] #=> nil

h1 = Hash.ne...
...w("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...

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

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

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

@param name スレッド固有データのキーを文字列か Symbol で指定します。

//emlist[例][ruby]{
[
Thread.new { Thread.current["name"] = "A" },
Thread.new { Thread.curr...
...= "C" }
].each do |th|
th.join
puts "#{th.inspect}: #{th[:name]}"
end

# => #<Thread:0x00000002a54220 dead>: A
# => #<Thread:0x00000002a541a8 dead>: B
# => #<Thread:0x00000002a54130 dead>: C
//}

Thread#[] と Thread#[]= を用いたスレッド固有の変数は
Fiber を切り替えると異...
...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#[]=...

YAML::DBM#[](key) -> object | nil (18206.0)

データベースからキーを探して対応する要素の値を返します。

...データベースからキーを探して対応する要素の値を返します。

対応する値が見つからなかった場合は nil を返します。DBM#[] とは異
なり、IndexError は発生しません。

@param key キーを文字列で指定します。

@see YAML::DBM#fetch...

Net::IMAP::FetchData#attr -> { String => object } (6124.0)

各メッセージのアトリビュートの値をハッシュテーブルで返します。

...Net::IMAP::BodyTypeBasic, Net::IMAP::BodyTypeText,
Net::IMAP::BodyTypeMessage, Net::IMAP::BodyTypeMultipart
のいずれか。
: BODY[<section>]<<partial>>
section で指定されたセクションのボディの内容。文字列。
: BODY.PEEK[<section>]<<partial>>
section で...
...
Net::IMAP::Envelope オブジェクト。
: FLAGS
メッセージにセットされたフラグ。
Symbol の配列。String#capitalize でキャピタライズ
されている。
: INTERNALDATE
メッセージの内部日付。文字列。
: RFC822
BODY[] と同じ。文...
...BODY.PEEK[HEADER] と同じ。文字列。
: RFC822.SIZE
メッセージの 822 サイズ。整数。
: RFC822.TEXT
BODY[TEXT] と同じ。文字列。
: UID
UID。整数。

詳しくは 2060 の FETCH command の節を見てください。

@see Net::IMAP#fetch, Net::IMAP#uid_fetch...

絞り込み条件を変える

1.6.8から1.8.0への変更点(まとめ) (612.0)

1.6.8から1.8.0への変更点(まとめ) * ((<1.6.8から1.8.0への変更点(まとめ)/インタプリタの変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたクラス/モジュール>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加されたメソッド>)) * ((<1.6.8から1.8.0への変更点(まとめ)/追加された定数>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張されたクラス/メソッド(互換性のある変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/変更されたクラス/メソッド(互換性のない変更)>)) * ((<1.6.8から1.8.0への変更点(まとめ)/文法の変更>)) * ((<1.6.8から1.8.0への変更点(まとめ)/正規表現>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Marshal>)) * ((<1.6.8から1.8.0への変更点(まとめ)/Windows 対応>)) * ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>)) * ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>)) * ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>)) * ((<1.6.8から1.8.0への変更点(まとめ)/バグ修正>)) * ((<1.6.8から1.8.0への変更点(まとめ)/サポートプラットフォームの追加>))

...の変更点(まとめ)/Windows 対応>))
* ((<1.6.8から1.8.0への変更点(まとめ)/廃止された(される予定の)機能>))
* ((<1.6.8から1.8.0への変更点(まとめ)/ライブラリ>))
* ((<1.6.8から1.8.0への変更点(まとめ)/拡張ライブラリAPI>))
* ((<1.6.8から1.8.0...
...ます。def は nil を返し
ます。while/until は、通常 nil を返しますが、break の引数により任意
の値を返すことができます。

: 多重代入 [change]

多重代入の規則を見直しました。

# # derived from sample/test.rb
# a = *[]; p a...
...(ARGF.filename の別名) ((<ruby-dev:20197>))

=== Array

: ((<Array#transpose|Array/transpose>)) [new]

追加

: ((<Array#zip|Enumerable/zip>)) [new]
: ((<Enumerable#zip|Enumerable/zip>)) [new]

追加

: ((<Array#fetch|Array/fetch>)) [new]

追加

: ((<Array#insert|Array/insert>))...

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) -> Enumerator (206.0)

node から到達可能な強連結成分についてのイテレータです。

...定します。

//emlist[例 到達可能なノードを表示する][ruby]{
require 'tsort'

class Hash
i
nclude TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch
(node).each(&block)
end
end

non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

non_sort.each_strongl...
...y_connected_component{|nodes|
p nodes
nodes.each {|node|
non_sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,...

TSort#each_strongly_connected_component_from(node, id_map={}, stack=[]) {|nodes| ...} -> () (206.0)

node から到達可能な強連結成分についてのイテレータです。

...定します。

//emlist[例 到達可能なノードを表示する][ruby]{
require 'tsort'

class Hash
i
nclude TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch
(node).each(&block)
end
end

non_sort = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}

non_sort.each_strongl...
...y_connected_component{|nodes|
p nodes
nodes.each {|node|
non_sort.each_strongly_connected_component_from(node){|ns|
printf("%s -> %s\n", node, ns.join(","))
}
}
}

#出力
#=> [4]
#=> 4 -> 4
#=> [2, 3]
#=> 2 -> 4
#=> 2 -> 2,3
#=> 3 -> 4
#=> 3 -> 3,2
#=> [1]
#=> 1 -> 4
#=> 1 -> 2,...

Hash.new(ifnone = nil) -> Hash (107.0)

空の新しいハッシュを生成します。ifnone はキーに対 応する値が存在しない時のデフォルト値です。設定したデフォルト値はHash#defaultで参照できます。

...ます。ifnone はキーに対
応する値が存在しない時のデフォルト値です。設定したデフォルト値はHash#defaultで参照できます。

i
fnoneを省略した Hash.new は {} と同じです。

デフォルト値として、毎回同一のオブジェクトifnoneを返...
...値にも影響します。

//emlist[][ruby]{
h = Hash.new([])
h[0] << 0
h[1] << 1
p h.default #=> [0, 1]
//}

これを避けるには、破壊的でないメソッドで再代入する必要が有ります。
また、このようなミスを防ぐためにもifnoneは freeze して破壊的操...
...作を禁止しておくのが無難です。


@param ifnone キーに対応する値が存在しない時のデフォルト値です。

//emlist[例][ruby]{
h = Hash.new([])

p h[1] #=> []
p h[1].object_id #=> 6127150
p h[1] << "bar" #=> ["bar"]
p h[1]...

tsort (24.0)

tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。

...=== Example

//emlist[][ruby]{
require 'tsort'

class Hash
i
nclude TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch
(node).each(&block)
end
end

{1=>[2, 3], 2=>[3], 3=>[], 4=>[]}.tsort
#=> [3, 2, 1, 4]

{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_c...
...きます。

//emlist[][ruby]{
require 'tsort'

class Make
def initialize
@dep = {}
@dep.default = []
end

def rule(outputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @dep[f] = [triple]}
@dep[triple] = inputs
end

def build(target)
each...
...ns|
i
f ns.length != 1
fs = ns.delete_if {|n| Array === n}
raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
end
n = ns.first
i
f Array === n
outputs, inputs, block = n
i
nputs_time = inputs.map {|f| File.mtime f}.max
begin...

絞り込み条件を変える

<< 1 2 > >>