別のキーワード
ライブラリ
- ビルトイン (924)
- abbrev (12)
-
cgi
/ core (12) - csv (24)
- date (4)
- erb (8)
- json (108)
-
json
/ add / bigdecimal (12) -
json
/ add / complex (12) -
json
/ add / date (12) -
json
/ add / date _ time (12) -
json
/ add / exception (12) -
json
/ add / range (12) -
json
/ add / rational (12) -
json
/ add / regexp (12) -
json
/ add / struct (12) -
json
/ add / time (12) -
net
/ http (36) - open-uri (12)
- optparse (36)
- rake (12)
-
rexml
/ document (48) - tsort (47)
-
webrick
/ httprequest (12)
クラス
- Array (68)
- BigDecimal (12)
- CGI (12)
-
CSV
:: Table (24) - Complex (12)
- Data (6)
- Date (14)
- DateTime (14)
- ERB (8)
-
Encoding
:: Converter (48) - Exception (12)
- Float (12)
- Hash (372)
- MatchData (1)
- Method (12)
- Module (12)
- Numeric (12)
- Object (12)
- OptionParser (24)
-
REXML
:: Attributes (12) -
REXML
:: DocType (12) -
REXML
:: Element (24) -
Rake
:: TaskArguments (12) - Range (24)
- Rational (12)
- Regexp (36)
-
RubyVM
:: InstructionSequence (12) - String (240)
- Struct (34)
- Time (14)
- UnboundMethod (12)
-
WEBrick
:: HTTPRequest (12)
モジュール
- Enumerable (57)
-
JSON
:: Generator :: GeneratorMethods :: Array (12) -
JSON
:: Generator :: GeneratorMethods :: FalseClass (12) -
JSON
:: Generator :: GeneratorMethods :: Float (12) -
JSON
:: Generator :: GeneratorMethods :: Hash (12) -
JSON
:: Generator :: GeneratorMethods :: Integer (12) -
JSON
:: Generator :: GeneratorMethods :: NilClass (12) -
JSON
:: Generator :: GeneratorMethods :: Object (12) -
JSON
:: Generator :: GeneratorMethods :: String (12) -
JSON
:: Generator :: GeneratorMethods :: TrueClass (12) -
Net
:: HTTPHeader (36) -
OpenURI
:: Meta (12) -
OptionParser
:: Arguable (12) - TSort (47)
キーワード
- % (12)
- abbrev (12)
-
add
_ attributes (12) -
add
_ element (12) - assoc (12)
- collect (14)
-
compare
_ by _ identity (12) -
compare
_ by _ identity? (12) -
deconstruct
_ keys (9) -
default
_ proc (12) -
delete
_ if (12) - difference (7)
- dig (20)
-
each
_ pair (24) -
each
_ strongly _ connected _ component (12) -
each
_ strongly _ connected _ component _ from (23) - encode (36)
- entities (12)
- eql? (24)
- fetch (36)
- filter (14)
- filter! (14)
- getopts (36)
-
group
_ by (24) - gsub (48)
- gsub! (48)
- header (12)
- inspect (12)
- intersection (6)
- invert (12)
-
keep
_ if (19) - length (12)
- map (14)
-
named
_ captures (13) - namespaces (12)
-
primitive
_ convert (48) - query (12)
- rassoc (12)
- reject (24)
- reject! (24)
- result (8)
-
ruby2
_ keywords (12) - select (14)
- select! (19)
- size (12)
- sub (36)
- sub! (36)
-
to
_ a (12) -
to
_ csv (12) -
to
_ h (19) -
to
_ json (228) -
to
_ s (24) -
transform
_ keys (20) -
transform
_ keys! (20) -
transform
_ values (18) -
transform
_ values! (18) -
tsort
_ each (12) - union (7)
-
with
_ defaults (12)
検索結果
先頭5件
-
RubyVM
:: InstructionSequence # to _ a -> Array (35131.0) -
self の情報を 14 要素の配列にして返します。
...ます。
: magic
データフォーマットを示す文字列。常に
"YARVInstructionSequence/SimpleDataFormat"。
: major_version
命令シーケンスのメジャーバージョン。
: minor_version
命令シーケンスのマイナーバージョン。
: format_type
デー......1。
: misc
以下の要素から構成される Hash オブジェクト。
:arg_size: メソッド、ブロックが取る引数の総数(1 つもない場合は 0)。
:local_size: ローカル変数の総数 + 1。
:stack_max: スタックの深さ。(SystemStackError を検出......in>"。文字列から作成していた場合は
"<compiled>"。
: #path
命令シーケンスの相対パス。文字列から作成していた場合は "<compiled>"。
: #absolute_path
命令シーケンスの絶対パス。文字列から作成していた場合は nil。
: #first_li... -
Hash
# hash -> Integer (27326.0) -
自身が保持するキーと値のハッシュ値を元にして算出した整数を返します。 自身が保持するキーや値が変化すればこのメソッドが返す値も変化します。
...自身が保持するキーと値のハッシュ値を元にして算出した整数を返します。
自身が保持するキーや値が変化すればこのメソッドが返す値も変化します。
//emlist[例][ruby]{
a = {}
p a.hash #=> 0
a[1] = :x
p a.hash #=> 329543
//}... -
String
# hash -> Integer (24338.0) -
self のハッシュ値を返します。 eql? で等しい文字列は、常にハッシュ値も等しくなります。
...self のハッシュ値を返します。
eql? で等しい文字列は、常にハッシュ値も等しくなります。
//emlist[例][ruby]{
"test".hash # => 4038258770210371295
("te" + "st").hash == "test".hash # => true
//}
@see Hash... -
Hash
# invert -> Hash (21350.0) -
値からキーへのハッシュを作成して返します。
...mlist[例][ruby]{
h = { "a" => 0, "b" => 100, "c" => 200, "d" => 300, "e" => 300 }
p h.invert #=> {0=>"a", 100=>"b", 200=>"c", 300=>"e"}
//}
=== 参考
値が重複していたときに備えて、変換後の値を配列として保持するには、次のようにします。
//emlist[][ruby]{......def safe_invert(orig_hash)
orig_hash.each_key.group_by do |key|
orig_hash[key]
end
end
p safe_invert({"a"=>1, "b"=>1, "c"=>3}) # => {1=>["a", "b"], 3=>["c"]}
//}
@see Hash#key... -
Hash
# filter! {|key , value| . . . } -> self | nil (21343.0) -
キーと値を引数としてブロックを評価した結果が真であるような要素を self に残します。
...ます。
keep_if は常に self を返します。
filter! と select! はオブジェクトが変更された場合に self を、
されていない場合に nil を返します。
ブロックが与えられなかった場合は、自身と keep_if から生成した
Enumerator オブジェク....../emlist[例][ruby]{
h1 = {}
c = ("a".."g")
c.each_with_index {|e, i| h1[i] = e }
h2 = h1.dup
h1.select! # => #<Enumerator: {0=>"a", 1=>"b", 2=>"c", 3=>"d", 4=>"e", 5=>"f", 6=>"g"}:select!>
h1.select! { |k, v| k % 3 == 0 } # => {0=>"a", 3=>"d", 6=>"g"}
h1.select! { |k, v| true } # => nil
h......2.keep_if { |k, v| k % 3 == 0 } # => {0=>"a", 3=>"d", 6=>"g"}
h2.keep_if { |k, v| true } # => {0=>"a", 3=>"d", 6=>"g"}
//}
@see Hash#select, Hash#delete_if, Hash#reject!... -
Array
# hash -> Integer (21338.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
//}... -
Regexp
# hash -> Integer (21332.0) -
正規表現のオプションやテキストに基づいたハッシュ値を返します。
...正規表現のオプションやテキストに基づいたハッシュ値を返します。
//emlist[例][ruby]{
p /abc/i.hash # => 4893115
p /abc/.hash # => 4856055
//}... -
Hash
# filter -> Enumerator (21327.0) -
key, value のペアについてブロックを評価し,真となるペアだけを含む ハッシュを生成して返します。
...った場合は、自身と select から生成した
Enumerator オブジェクトを返します。
//emlist[][ruby]{
h = { "a" => 100, "b" => 200, "c" => 300 }
h.select {|k,v| k > "a"} #=> {"b" => 200, "c" => 300}
h.select {|k,v| v < 200} #=> {"a" => 100}
//}
@see Hash#select!, Hash#reject... -
Hash
# filter {|key , value| . . . } -> Hash (21327.0) -
key, value のペアについてブロックを評価し,真となるペアだけを含む ハッシュを生成して返します。
...った場合は、自身と select から生成した
Enumerator オブジェクトを返します。
//emlist[][ruby]{
h = { "a" => 100, "b" => 200, "c" => 300 }
h.select {|k,v| k > "a"} #=> {"b" => 200, "c" => 300}
h.select {|k,v| v < 200} #=> {"a" => 100}
//}
@see Hash#select!, Hash#reject... -
Range
# hash -> Integer (21326.0) -
始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
...始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。
//emlist[例][ruby]{
p (1..2).hash # => 5646
p (1...2).hash # => 16782863
//}...