るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
10件ヒット [1-10件を表示] (0.255秒)

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

クラス

検索結果

Hash#to_hash -> self (72679.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 (72625.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 (72625.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"}

Object#to_hash -> Hash (72625.0)

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

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

説明のためここに記載してありますが、
このメソッドは実際には Object クラスには定義されていません。
必要に応じてサブクラスで定義すべきものです。

このメソッドを定義する条件は、
* ハッシュが使われるすべての場面で代置可能であるような、
* ハッシュそのものとみなせるようなもの
という厳しいものになっています。

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

it = Foo...

Rake::TaskArguments#to_hash -> Hash (72625.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 (72625.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"}

GDBM#to_hash -> Hash (72607.0)

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

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

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

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

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

JSON::State#to_hash -> Hash (63628.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,
# ...

JSON::State#to_h -> Hash (54328.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,
# ...

絞り込み条件を変える