ライブラリ
- ビルトイン (267)
- abbrev (12)
-
cgi
/ core (12) - csv (84)
- date (4)
- json (84)
- open3 (108)
- openssl (24)
- ostruct (10)
- pstore (12)
- psych (19)
-
rexml
/ document (12) -
rinda
/ rinda (36) -
rinda
/ tuplespace (48) -
rubygems
/ dependency _ list (12) - tsort (24)
-
webrick
/ config (12)
クラス
- Array (113)
- CSV (84)
- Data (3)
- Date (2)
- DateTime (2)
-
Gem
:: DependencyList (12) - Hash (100)
-
JSON
:: Parser (12) -
JSON
:: State (36) - MatchData (2)
-
OpenSSL
:: X509 :: ExtensionFactory (24) - OpenStruct (10)
- PStore (12)
-
REXML
:: Element (12) -
Rinda
:: TupleEntry (12) -
Rinda
:: TupleSpace (36) -
Rinda
:: TupleSpaceProxy (36) -
RubyVM
:: InstructionSequence (12) - Struct (16)
- Time (2)
モジュール
-
CGI
:: QueryExtension (12) - Enumerable (28)
- JSON (24)
-
JSON
:: Generator :: GeneratorMethods :: Array (12) - Open3 (108)
- Psych (19)
- TSort (24)
-
WEBrick
:: Config (12)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (12) - DigestAuth (12)
- Marshal フォーマット (12)
-
NEWS for Ruby 2
. 0 . 0 (12) -
NEWS for Ruby 2
. 2 . 0 (11) -
NEWS for Ruby 2
. 3 . 0 (10) -
NEWS for Ruby 2
. 4 . 0 (9) - Set (3)
- abbrev (12)
-
add
_ attributes (12) - collect (28)
- compact (9)
- compact! (9)
-
create
_ extension (24) -
deconstruct
_ keys (17) - difference (7)
- dig (40)
- flatten (12)
- generate (12)
-
generate
_ line (12) - intersection (6)
- map (28)
- new (48)
- params (12)
- parse (24)
-
parse
_ line (12) - pipeline (12)
-
pipeline
_ r (24) -
pipeline
_ rw (24) -
pipeline
_ start (24) -
pipeline
_ w (24) - read (36)
-
read
_ all (24) - readlines (12)
- roots (12)
-
ruby 1
. 6 feature (12) -
ruby 1
. 8 . 2 feature (12) -
ruby 1
. 8 . 4 feature (12) -
ruby 1
. 9 feature (12) -
safe
_ load (19) - set (9)
- shift (12)
-
spec
_ predecessors (12) -
strongly
_ connected _ components (12) - table (12)
- take (24)
-
to
_ a (24) -
to
_ h (31) -
to
_ hash (12) -
to
_ json (12) - tsort (24)
- union (7)
- unparse (12)
- value (12)
-
values
_ at (12) - yaml (12)
- | (12)
- パターンマッチ (12)
- リテラル (12)
検索結果
先頭5件
-
Array
# hash -> Integer (27241.0) -
自身のハッシュ値を整数で返します。ハッシュ値は自身の各要素のハッシュ値から 計算されます。Array#eql? で比較して等しい配列同士は同じハッシュ値を返します。
...ら
計算されます。Array#eql? で比較して等しい配列同士は同じハッシュ値を返します。
//emlist[例][ruby]{
a = ["a", "b", 1]
a.hash #=> 321
b = a.dup
b.hash #=> 321
["a", 1, "b"].hash #=> 491
["a", 1.0, "b"].hash #=> 466227
//}... -
tsort (26132.0)
-
tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
...tsort はトポロジカルソートと強連結成分に関するモジュールを提供します。
=== Example
//emlist[][ruby]{
require 'tsort'
class Hash
include TSort
alias tsort_each_node each_key
def tsort_each_child(node, &block)
fetch(node).each(&block)
end
end
{1=>[2, 3],......=>[]}.tsort
#=> [3, 2, 1, 4]
{1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}.strongly_connected_components
#=> [[4], [2, 3], [1]]
//}
=== より現実的な例
非常に単純な `make' に似たツールは以下のように実装できます。
//emlist[][ruby]{
require 'tsort'
class Make
def initialize......utputs, inputs=[], &block)
triple = [outputs, inputs, block]
outputs.each {|f| @dep[f] = [triple]}
@dep[triple] = inputs
end
def build(target)
each_strongly_connected_component_from(target) {|ns|
if ns.length != 1
fs = ns.delete_if {|n| Array === n}
raise T... -
Array
# intersection(*other _ arrays) -> Array (15313.0) -
自身と引数に渡された配列の共通要素を新しい配列として返します。 要素が重複する場合は、そのうちの1つのみを返します。 要素の順序は自身の順序を維持します。
...持します。
@param other_arrays 自身と共通要素を取りたい配列を指定します。
配列以外のオブジェクトを指定した場合は to_ary
メソッドによる暗黙の型変換を試みます。
@raise TypeError 引数に配列以......合に発生します。
intersectionはObject#hashとObject#eql?を使って比較を行います。
//emlist[例][ruby]{
[1, 1, 3, 5].intersection([3, 2, 1]) # => [1, 3]
["a", "b", "z"].intersection(["a", "b", "c"], ["b"]) # => ["b"]
["a"].intersection......# => ["a"]
//}
@see Set#intersection, Array#&... -
OpenSSL
:: X509 :: ExtensionFactory # create _ extension(obj) -> OpenSSL :: X509 :: Extension (15312.0) -
OpenSSL::X509::Extension のインスタンスを生成して返します。
...9::Extension のインスタンスを生成して返します。
引数の個数が1個である場合、それが配列、ハッシュ、文字列のいずれかである
ならば、
OpenSSL::X509::ExtensionFactory#create_ext_from_array、
OpenSSL::X509::ExtensionFactory#create_ext_from_hash、
O......penSSL::X509::ExtensionFactory#create_ext_from_string、
がそれぞれ呼びだされてオブジェクトを生成します。
引数が2個以上である場合は、
OpenSSL::X509::ExtensionFactory#create_ext が呼びだされて
オブジェクトを生成します。
@param obj 拡張領......域のデータ。配列、ハッシュ、文字列のいずれか
@param oid 拡張領域の識別子を表す文字列
@param value 拡張領域の値を表す文字列
@param critical 重要度(真偽値)... -
OpenSSL
:: X509 :: ExtensionFactory # create _ extension(oid , value , critical=false) -> OpenSSL :: X509 :: Extension (15312.0) -
OpenSSL::X509::Extension のインスタンスを生成して返します。
...9::Extension のインスタンスを生成して返します。
引数の個数が1個である場合、それが配列、ハッシュ、文字列のいずれかである
ならば、
OpenSSL::X509::ExtensionFactory#create_ext_from_array、
OpenSSL::X509::ExtensionFactory#create_ext_from_hash、
O......penSSL::X509::ExtensionFactory#create_ext_from_string、
がそれぞれ呼びだされてオブジェクトを生成します。
引数が2個以上である場合は、
OpenSSL::X509::ExtensionFactory#create_ext が呼びだされて
オブジェクトを生成します。
@param obj 拡張領......域のデータ。配列、ハッシュ、文字列のいずれか
@param oid 拡張領域の識別子を表す文字列
@param value 拡張領域の値を表す文字列
@param critical 重要度(真偽値)... -
Hash
# compact -> Hash (15259.0) -
compact は自身から value が nil のもの取り除いた Hash を生成して返します。 compact! は自身から破壊的に value が nil のものを取り除き、変更が行われた場合は self を、そうでなければ nil を返します。
...compact は自身から value が nil のもの取り除いた Hash を生成して返します。 compact! は自身から破壊的に value が nil のものを取り除き、変更が行われた場合は self を、そうでなければ nil を返します。
//emlist[例][ruby]{
hash = {a: 1......, b: nil, c: 3}
p hash.compact #=> {:a=>1, :c=>3}
p hash #=> {:a=>1, :b=>nil, :c=>3}
hash.compact!
hash #=> {:a=>1, :c=>3}
p hash.compact! #=> nil
//}
@see Array#compact... -
Array
# to _ h -> Hash (15218.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...を Hash にして
返します。
//emlist[例][ruby]{
bar], [1, 2.to_h # => {:foo => :bar, 1 => 2}
//}
ブロックを指定すると配列の各要素でブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
["foo", "bar"].to_h {|... -
Array
# to _ h { block } -> Hash (15218.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...を Hash にして
返します。
//emlist[例][ruby]{
bar], [1, 2.to_h # => {:foo => :bar, 1 => 2}
//}
ブロックを指定すると配列の各要素でブロックを呼び出し、
その結果をペアとして使います。
//emlist[ブロック付きの例][ruby]{
["foo", "bar"].to_h {|... -
Array
# to _ h -> Hash (15217.0) -
self を [key, value] のペアの配列として解析した結果を Hash にして 返します。
...self を [key, value] のペアの配列として解析した結果を Hash にして
返します。
//emlist[例][ruby]{
bar], [1, 2.to_h # => {:foo => :bar, 1 => 2}
//}... -
Hash
# flatten(level = 1) -> Array (15213.0) -
自身を平坦化した配列を生成して返します。
...。
Array#flatten と違って、デフォルトではこのメソッドは自身を
再帰的に平坦化しません。level を指定すると指定されたレベルまで
再帰的に平坦化します。
@param level 展開するレベル
//emlist[例][ruby]{
a = {1=> "one", 2 => [2,"two"],......3 => "three"}
a.flatten #=> [1, "one", 2, [2, "two"], 3, "three"]
a.flatten(1) #=> [1, "one", 2, [2, "two"], 3, "three"]
a.flatten(2) #=> [1, "one", 2, 2, "two", 3, "three"]
a.flatten(0) #=> [[1, "one"], [2, [2, "two"]], [3, "three"]]
a.flatten(-1) #=> [1, "one", 2, 2, "two", 3, "three"]
//}......@see Array#flatten... -
Hash
# to _ a -> [Array] (15213.0) -
キーと値からなる 2 要素の配列を並べた配列を生成して返します。
...キーと値からなる 2 要素の配列を並べた配列を生成して返します。
//emlist[例][ruby]{
h1 = { "a" => 100, 2 => ["some"], :c => "c" }
p h1.to_a #=> c, "c"
//}
@see Hash#keys,Hash#values...