るりまサーチ

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

別のキーワード

  1. _builtin hash
  2. dbm to_hash
  3. matrix hash
  4. hash []
  5. _builtin to_hash

ライブラリ

クラス

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Hash#to_hash -> self (33268.0)

self を返します。

...self を返します。

//emlist[例][ruby]{
hash
= {}
p hash.to_hash # => {}
p hash.to_hash == hash # => true
//}

@see Object#to_hash, Hash#to_h...

Object#to_hash -> Hash (24331.0)

オブジェクトの Hash への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。

...オブジェクトの Hash への暗黙の変換が必要なときに内部で呼ばれます。
デフォルトでは定義されていません。

説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要...
...すべての場面で代置可能であるような、
* ハッシュそのものとみなせるようなもの
という厳しいものになっています。

//emlist[][ruby]{
class Foo
def to_hash
{'as' => 24}
end
end

it = Foo.new
p({:as => 12}.merge(it)) #=> {"as"=>24, :as=>12}
//}...

CSV::Row#to_hash -> Hash (24315.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 (24315.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"}...

Rake::TaskArguments#to_hash -> Hash (24315.0)

パラメータ名と対応する値を格納したハッシュを返します。

...納したハッシュを返します。

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

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

絞り込み条件を変える

SDBM#to_hash -> Hash (24315.0)

self の各要素を格納したハッシュを返します。

...self の各要素を格納したハッシュを返します。

require 'sdbm'

db1 = SDBM.open('aaa.gdbm', 0666)
db1.clear
db1['a'] = 'aaa'
db1['b'] = 'bbb'
db1['c'] = 'ccc'

p db1.to_hash #=> {"a"=>"aaa", "b"=>"bbb", "c"=>"ccc"}...

ENV.to_hash -> Hash (24303.0)

環境変数の名前をキーとし、対応する値をもつハッシュを返します。

環境変数の名前をキーとし、対応する値をもつハッシュを返します。

GDBM#to_hash -> Hash (24303.0)

self の各要素を格納したハッシュを返します。

self の各要素を格納したハッシュを返します。

YAML::DBM#to_hash -> Hash (24303.0)

自身のキー、値をハッシュにしたものを返します。

自身のキー、値をハッシュにしたものを返します。

JSON::State#to_hash -> Hash (18304.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,
# :max_nesting=>100,
# ...

絞り込み条件を変える

<< 1 2 3 ... > >>