るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
4件ヒット [1-4件を表示] (0.018秒)
トップページ > バージョン:2.6.0[x] > クエリ:Hash[x] > クラス:JSON::State[x]

別のキーワード

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

ライブラリ

キーワード

検索結果

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

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

JSON::State.from_state(options) -> JSON::State (22.0)

与えられた options によって生成した JSON::State のインスタンスを返します。

... JSON::State のインスタンスを返します。

@param options JSON::State のインスタンスか、ハッシュを指定します。

@return options がハッシュである場合は、それによって初期化した JSON::State
返します。options が JSON::State...
...ていない JSON::State
インスタンスを返します。

//emlist[例 Hash を指定][ruby]{
require "json"

json_state = JSON::State.from_state(indent: "\t")
json_state.class # => JSON::Ext::Generator::State
json_state.indent # => "\t"
//}

//emlist[例 JSON::State を指定][rub...
...y]{
require "json"

json_state = JSON::State.from_state(indent: "\t")
# JSON を出力する何らかの処理を実行する
copy = JSON::State.from_state(json_state)
copy.class # => JSON::Ext::Generator::State
copy.indent # => "\t"
//}...

JSON::State.new(options = {}) -> JSON::State (22.0)

自身を初期化します。

...by]{
require "json"

json_state = JSON::State.new(indent: "\t")
json_state.class # => JSON::Ext::Generator::State
json_state.indent # => "\t"
//}

//emlist[例 JSON::State を指定][ruby]{
require "json"

json_state = JSON::State.new(indent: "\t")
copy = JSON::State.new(json_state)
copy.class # =...