クラス
-
JSON
:: Parser (11) -
JSON
:: State (77) - Module (11)
モジュール
- JSON (66)
キーワード
- NestingError (11)
- Ruby用語集 (11)
-
check
_ circular? (11) - depth (11)
- depth= (11)
- generate (11)
- load (11)
-
max
_ nesting (11) -
max
_ nesting= (11) - new (11)
- parse (11)
- parse! (11)
-
rb
_ mod _ nesting (11) - restore (11)
-
to
_ h (11) -
to
_ hash (11) - unparse (11)
検索結果
先頭5件
-
Module
. nesting -> [Class , Module] (18107.0) -
このメソッドを呼び出した時点でのクラス/モジュールのネスト情 報を配列に入れて返します。
...このメソッドを呼び出した時点でのクラス/モジュールのネスト情
報を配列に入れて返します。
//emlist[例][ruby]{
module Foo
module Bar
module Baz
p Module.nesting # => [Foo::Bar::Baz, Foo::Bar, Foo]
end
end
end
//}... -
JSON
:: State # max _ nesting -> Integer (6125.0) -
生成される JSON 形式の文字列のネストの深さの最大値を返します。
..._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... -
JSON
:: State # max _ nesting=(depth) (6125.0) -
生成される JSON 形式の文字列のネストの深さの最大値をセットします。
...せん。
//emlist[例][ruby]{
require "json"
json_state = JSON::State.new(max_nesting: 2)
json_state.max_nesting # => 2
JSON.generate([[]], json_state)
json_state.max_nesting = 3
json_state.max_nesting # => 3
JSON.generate([[[[]]]], json_state) # => JSON::NestingError
//}... -
static VALUE rb
_ mod _ nesting(void) (6100.0) -
-
JSON
:: NestingError (6000.0) -
パースしようとしているデータ構造のネストが深すぎる場合に発生する例外です。
パースしようとしているデータ構造のネストが深すぎる場合に発生する例外です。 -
JSON
:: State # depth=(depth) (32.0) -
This sets the maximum level of data structure nesting in the generated JSON to the integer depth, max_nesting = 0 if no maximum should be checked.
...This sets the maximum level of data structure nesting in the generated
JSON to the integer depth, max_nesting = 0 if no maximum should be
checked.... -
JSON
:: State # check _ circular? -> bool (24.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[例 ネストをチェックしないケース][ruby......]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s2 = JSON.state.new(max_nesting: 0)
json = JSON.generate(a, s2)
[json, s2.max_nesting, s2.check_circular?] # => ["[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[... -
JSON
:: State # depth -> Integer (16.0) -
This integer returns the current depth of data structure nesting.
...This integer returns the current depth of data structure nesting.... -
JSON
. # generate(object , state = nil) -> String (6.0) -
与えられたオブジェクトを一行の JSON 形式の文字列に変換して返します。
...。
偽を指定した場合、これらの値を生成しようとすると例外が発生します。
デフォルトは偽です。
: :max_nesting
入れ子になっているデータの最大の深さを指定します。
偽を指定すると深さのチェックを行いません。デ... -
JSON
. # load(source , proc = nil , options = {}) -> object (6.0) -
与えられた JSON 形式の文字列を Ruby オブジェクトとしてロードして返します。
...します。
@param options オプションをハッシュで指定します。指定可能なオプションは以下の通りです。
: :max_nesting
入れ子になっているデータの最大の深さを指定します。
偽を指定すると深さのチェックを行いません。デ...