るりまサーチ

最速Rubyリファレンスマニュアル検索!
176件ヒット [1-100件を表示] (0.139秒)
トップページ > クエリ:I[x] > クエリ:Require[x] > クエリ:j[x] > クラス:JSON::State[x]

別のキーワード

  1. _builtin to_i
  2. fiddle to_i
  3. matrix elements_to_i
  4. _builtin i
  5. matrix i

ライブラリ

キーワード

検索結果

<< 1 2 > >>

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

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

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

この値がゼロである場合は、ネストの深さのチェックを行いません。

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

j
son_state = JSON::State.new(max_nesting: 2)
j
so...
...ax_nesting # => 2
J
SON.generate([[]], json_state)
J
SON.generate([[[]]], json_state) # => JSON::NestingError
//}

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

j
son_state = JSON::State.new(max_nesting: 0)
j
son_state.max_nesting # => 0
J
SON.ge...
...nerate([[[[[[[[[[]]]]]]]]]], json_state)
//}...

JSON::State#indent -> String (9207.0)

インデントに使用する文字列を返します。

...インデントに使用する文字列を返します。

//emlist[例][ruby]{
require
"json"

j
son_state = JSON::State.new(indent: "\t")
j
son_state.indent # => "\t"
J
SON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"
//}...

JSON::State#indent=(string) (9207.0)

インデントに使用する文字列をセットします。

...ring インデントに使用する文字列を指定します。

//emlist[例][ruby]{
require
"json"

j
son_state = JSON::State.new(indent: "\t")
j
son_state.indent # => "\t"
J
SON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"
j
son_state.i...
...ndent = " "
J
SON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{ \"key1\":\"value1\", \"key2\":\"value2\"}"
//}...

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

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

...//emlist[例 ネストをチェックするケース][ruby]{
require
"json"

a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
s = JSON.st...
...ate.new
begin
J
SON.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]{
require
"json"

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

JSON::State#configure(options = {}) -> self (9107.0)

与えられたハッシュで自身を設定します。

...キーについては JSON::State.new を参照してください。

@param options このオブジェクトの設定をするためのハッシュを指定します。

//emlist[例][ruby]{
require
"json"

j
son_state = JSON::State.new(indent: "\t")
j
son_state.indent # => "\t"
J
SON.generate({key1:...
..."value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"

j
son_state.configure(indent: " ")
j
son_state.indent # => " "
J
SON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{ \"key1\":\"value1\", \"key2\":\"value2\"}"
//}

@see JSON::State.new...

絞り込み条件を変える

JSON::State#max_nesting=(depth) (9107.0)

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

...される JSON 形式の文字列のネストの深さの最大値をセットします。

この値にゼロをセットすると、ネストの深さのチェックを行いません。

//emlist[例][ruby]{
require
"json"

j
son_state = JSON::State.new(max_nesting: 2)
j
son_state.max_nesting...
...# => 2
J
SON.generate([[]], json_state)
j
son_state.max_nesting = 3
j
son_state.max_nesting # => 3
J
SON.generate([[[[]]]], json_state) # => JSON::NestingError
//}...

JSON::State#object_nl -> String (6207.0)

JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。

...
J
SON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を返します。

//emlist[例][ruby]{
require
"json"

j
son_state = JSON::State.new(object_nl: "")
j
son_state.object_nl # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }...
...], json_state)
# => [1,2,{"name":"tanaka","age":19}]

j
son_state = JSON::State.new(object_nl: "\n")
j
son_state.object_nl # => "\n"
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)

# => [1,2,{
# "name":"tanaka",
# "age":19
# }]
//}...

JSON::State#object_nl=(string) (6207.0)

JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列をセットします。

...
J
SON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列をセットします。

@param string JSON 形式の文字列中に現れる JavaScript のオブジェクトの行末に挿入する文字列を指定します。

//emlist[例][ruby]{
require
...
..."json"

j
son_state = JSON::State.new(object_nl: "")
j
son_state.object_nl # => ""
puts JSON.generate([1, 2, { name: "tanaka", age: 19 }], json_state)
# => [1,2,{"name":"tanaka","age":19}]

j
son_state.object_nl = "\n"
j
son_state.object_nl # => "\n"
puts JSON.generate([1, 2, {...
...name: "tanaka", age: 19 }], json_state)
# => [1,2,{
# "name":"tanaka",
# "age":19
# }]
//}...

JSON::State#merge(options = {}) -> self (6107.0)

与えられたハッシュで自身を設定します。

...キーについては JSON::State.new を参照してください。

@param options このオブジェクトの設定をするためのハッシュを指定します。

//emlist[例][ruby]{
require
"json"

j
son_state = JSON::State.new(indent: "\t")
j
son_state.indent # => "\t"
J
SON.generate({key1:...
..."value1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"

j
son_state.configure(indent: " ")
j
son_state.indent # => " "
J
SON.generate({key1: "value1", key2: "value2"}, json_state)
# => "{ \"key1\":\"value1\", \"key2\":\"value2\"}"
//}

@see JSON::State.new...

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

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

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

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

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

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

j
son_state = JSON:...
...te(indent: "\t")
j
son_state.class # => JSON::Ext::Generator::State
j
son_state.indent # => "\t"
//}

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

j
son_state = JSON::State.from_state(indent: "\t")
# JSON を出力する何らかの処理を実行する
copy = JSON::State.from_state(json...

絞り込み条件を変える

<< 1 2 > >>