301件ヒット
[101-200件を表示]
(0.079秒)
ライブラリ
クラス
- Array (47)
-
CSV
:: Row (12) - DBM (12)
- Data (6)
- GDBM (12)
- Hash (31)
-
JSON
:: State (24) - NilClass (12)
- Object (12)
-
OpenSSL
:: X509 :: Extension (12) - OpenStruct (19)
-
Rake
:: TaskArguments (12) - SDBM (12)
- Struct (19)
-
YAML
:: DBM (12)
モジュール
- Enumerable (47)
検索結果
先頭5件
-
JSON
:: State # to _ h -> Hash (18108.0) -
自身をハッシュに変換します。
...自身をハッシュに変換します。
//emlist[例][ruby]{
require "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,... -
NilClass
# to _ h -> {} (18108.0) -
{} を返します。
...{} を返します。
//emlist[例][ruby]{
nil.to_h #=> {}
//}... -
OpenStruct
# to _ h -> { Symbol => object } (18108.0) -
self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返 します。
...self を各要素の名前をキー(Symbol)、要素が値のハッシュに変換して返
します。
//emlist[例][ruby]{
require 'ostruct'
data = OpenStruct.new("country" => "Australia", :capital => "Canberra")
data.to_h # => {:country => "Australia", :capital => "Canberra" }
//}... -
Struct
# to _ h -> Hash (18108.0) -
self のメンバ名(Symbol)と値の組を Hash にして返します。
...して返します。
//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
Customer.new("Joe Smith", "123 Maple, Anytown NC", 12345).to_h
# => {:name=>"Joe Smith", :address=>"123 Maple, Anytown NC", :zip=>12345}
//}
[注意] 本メソッドの記述は Struct の下位クラスのイ... -
OpenSSL
:: X509 :: Extension # to _ h -> Hash (18102.0) -
拡張領域の内容を、 { "oid" => 識別子(extnID), "value" => 値(extnValue), "critical" => 重要度(critical) } というハッシュで返します。
拡張領域の内容を、
{ "oid" => 識別子(extnID), "value" => 値(extnValue), "critical" => 重要度(critical) }
というハッシュで返します。 -
JSON
:: State # to _ hash -> Hash (6108.0) -
自身をハッシュに変換します。
...自身をハッシュに変換します。
//emlist[例][ruby]{
require "json"
require "pp"
json_state = JSON::State.new
pp json_state.to_h
# => {:indent=>"",
# :space=>"",
# :space_before=>"",
# :object_nl=>"",
# :array_nl=>"",
# :allow_nan=>false,
# :ascii_only=>false,... -
Hash
# to _ hash -> self (6107.0) -
self を返します。
...self を返します。
//emlist[例][ruby]{
hash = {}
p hash.to_hash # => {}
p hash.to_hash == hash # => true
//}
@see Object#to_hash, Hash#to_h... -
CSV
:: Row # to _ hash -> Hash (6101.0) -
自身をシンプルなハッシュに変換します。
...プルなハッシュに変換します。
フィールドの順序は無視されます。
重複したフィールドは削除されます。
//emlist[例][ruby]{
require "csv"
row = CSV::Row.new(["header2", "header1", "header2"], [1, 2, 3])
row.to_hash # => {"header2"=>3, "header1"=>2}
//}... -
DBM
# to _ hash -> Hash (6101.0) -
self をハッシュに変換して返します。
...self をハッシュに変換して返します。
require 'dbm'
db1 = DBM.open('aaa.db', 0666, DBM::NEWDB)
db1[:a] = 'aaa'
db1[:b] = 'bbbbbb'
p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbbbbb"}... -
GDBM
# to _ hash -> Hash (6101.0) -
self の各要素を格納したハッシュを返します。
self の各要素を格納したハッシュを返します。 -
Object
# to _ hash -> Hash (6101.0) -
オブジェクトの Hash への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...すべての場面で代置可能であるような、
* ハッシュそのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_hash
{'as' => 24}
end
end
it = Foo.new
p({:as => 12}.merge(it)) #=> {"as"=>24, :as=>12}
//}...