るりまサーチ

最速Rubyリファレンスマニュアル検索!
216件ヒット [1-100件を表示] (0.053秒)
トップページ > クエリ:Ruby[x] > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:require[x] > クエリ:j[x] > クラス:JSON::State[x]

別のキーワード

  1. fiddle ruby_free
  2. rbconfig ruby
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

JSON::State#object_nl -> String (6120.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) (6120.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#check_circular? -> bool (3038.0)

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

...ス][ruby]{
require
"json"

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

//emlist[例 ネストをチェックしないケース][ruby]{
require
"json"

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

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

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

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

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

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

j
son_state = JSON::State.new(max_nesting: 2)
j
so...
...# => 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.generate([[[[...
...[[[[[[]]]]]]]]]], json_state)
//}...

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

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

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

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

j
son_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_hash -> Hash (3026.0)

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

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

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

j
son_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#allow_nan? -> bool (3020.0)

NaN, Infinity, -Infinity を生成できる場合、真を返します。 そうでない場合は偽を返します。

...finity を生成できる場合、真を返します。
そうでない場合は偽を返します。

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

j
son_state = JSON::State.new({})
j
son_state.allow_nan? # => false
j
son_state = JSON::State.new(allow_nan: true)
j
son_state.allow_nan? # => true
//}

@see 4627...

JSON::State#array_nl -> String (3020.0)

JSON の配列の後に出力する文字列を返します。

...
J
SON の配列の後に出力する文字列を返します。

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

j
son_state = JSON::State.new({})
j
son_state.array_nl # => ""
j
son_state = JSON::State.new(array_nl: "\n")
j
son_state.array_nl # => "\n"
//}...

JSON::State#array_nl=(str) (3020.0)

JSON の配列の後に出力する文字列をセットします。

...
J
SON の配列の後に出力する文字列をセットします。

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

j
son_state = JSON::State.new({})
j
son_state.array_nl # => ""
j
son_state.array_nl = "\n"
j
son_state.array_nl # => "\n"
//}...
<< 1 2 3 > >>