るりまサーチ

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

別のキーワード

  1. _builtin stat
  2. pathname stat
  3. csv stat
  4. gc stat
  5. stat atime

ライブラリ

クラス

モジュール

キーワード

検索結果

JSON::State#max_nesting -> Integer (21225.0)

生成される JSON 形式の文字列のネストの深さの最大値を返します。

..._state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
JSON.generate([[[]]], json_state) # => JSON::NestingError
//}

//emlist[例 ネストの深さチェックを行わない][ruby]{
require "json"

json_state = JSON::State.new(max_nesting...
...: 0)
json_state.max_nesting # => 0
JSON.generate([[[[[[[[[[]]]]]]]]]], json_state)
//}...

JSON::State#check_circular? -> bool (3118.0)

循環参照のチェックを行う場合は、真を返します。 そうでない場合は偽を返します。

...]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s = JSON.state.new
begin
JSON.generate(a, s)
rescue JSON::NestingError => e
[e, s.max_nesting, s.check_circular?] # => [#<JSON::NestingError: nesting of 100 is too deep>, 100, true]
end
//}

//emlist...
...]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s2 = JSON.state.new(max_nesting: 0)
json = JSON.generate(a, s2)
[json, s2.max_nesting, s2.check_circular?] # => ["[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[...

JSON::State#to_h -> Hash (3106.0)

自身をハッシュに変換します。

...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,
# :depth=>0,
# :buffer_ini...

JSON::State#to_hash -> Hash (3106.0)

自身をハッシュに変換します。

...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,
# :depth=>0,
# :buffer_ini...

JSON.#generate(object, state = nil) -> String (206.0)

与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。

...e は将来削除される予定です。

@param object JSON 形式の文字列に変換するオブジェクトを指定します。

@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを...
...す。
偽を指定した場合、これらの値を生成しようとすると例外が発生します。
デフォルトは偽です。
: :max_nesting
入れ子になっているデータの最大の深さを指定します。
偽を指定すると深さのチェックを行いません。...
...on"

JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => "[1,2,{\"name\": \"tanaka\",\"age\": 19}]"
//}

@see JSON::State, JSON.#pretty_generate...

絞り込み条件を変える

JSON.#unparse(object, state = nil) -> String (206.0)

与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。

...e は将来削除される予定です。

@param object JSON 形式の文字列に変換するオブジェクトを指定します。

@param state JSON::State または、to_hash や to_h メソッドでハッシュに変換可能なオブジェクトを指定できます。
ハッシュを...
...す。
偽を指定した場合、これらの値を生成しようとすると例外が発生します。
デフォルトは偽です。
: :max_nesting
入れ子になっているデータの最大の深さを指定します。
偽を指定すると深さのチェックを行いません。...
...on"

JSON.generate([1, 2, { name: "tanaka", age: 19 }])
# => "[1,2,{\"name\":\"tanaka\",\"age\":19}]"
json_state = JSON::State.new(space: " ")
JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => "[1,2,{\"name\": \"tanaka\",\"age\": 19}]"
//}

@see JSON::State, JSON.#pretty_generate...