るりまサーチ

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

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

<< 1 2 > >>

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

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

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

//emlist[例][ruby]{
r
equire "json"

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

JSON::State#buffer_initial_length -> Integer (6201.0)

This integer returns the current initial length of the buffer.

...This integer returns the current initial length of the buffer....

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

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

...ース][ruby]{
r
equire "json"

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

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

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

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

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

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

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

//emlist[例][ruby]{
r
equire "json"

json_state = JSON::State.new(indent: "\t")
json_state.indent # => "\t"
JSON.generate({key1: "value...
...1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"

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

@see JSON::State.new...

JSON::State#generate(obj) -> String (6201.0)

Generates a valid JSON document from object obj and returns the result. If no valid JSON document can be created this method raises a GeneratorError exception.

...Generates a valid JSON document from object obj and returns the
r
esult. If no valid JSON document can be created this method raises a
GeneratorError exception....

絞り込み条件を変える

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

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

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

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

//emlist[例][ruby]{
r
equire "json"

json_state = JSON::State.new(indent: "\t")
json_state.indent # => "\t"
JSON.generate({key1: "value...
...1", key2: "value2"}, json_state)
# => "{\t\"key1\":\"value1\",\t\"key2\":\"value2\"}"

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

@see JSON::State.new...

JSON::State#quirks_mode -> bool (6201.0)

Returns true, if quirks mode is enabled. Otherwise returns false.

...
R
eturns true, if quirks mode is enabled. Otherwise returns false....

JSON::State#quirks_mode? -> bool (6201.0)

Returns true, if quirks mode is enabled. Otherwise returns false.

...
R
eturns true, if quirks mode is enabled. Otherwise returns false....

JSON::State#space_before -> String (6201.0)

JSON 形式の文字列中で JavaScript のオブジェクトを表す部分にある ':' の 前に挿入する文字列を返します。

...の文字列中で JavaScript のオブジェクトを表す部分にある ':' の
前に挿入する文字列を返します。

//emlist[例][ruby]{
r
equire "json"

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

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

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

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

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

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

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

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

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

//emlist[例 JSON::State を指定][ruby]{
r
equire...
..."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"
//}...

絞り込み条件を変える

<< 1 2 > >>