るりまサーチ (Ruby 2.6.0)

最速Rubyリファレンスマニュアル検索!
29件ヒット [1-29件を表示] (0.093秒)

ライブラリ

検索結果

JSON::State#[](name) -> object (7.0)

Return the value returned by method name.

Return the value returned by method name.

JSON::State#[]=(name, value) (7.0)

Set the attribute name to value.

Set the attribute name to value.

JSON::State#allow_nan? -> bool (7.0)

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

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

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

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

@see 4627...

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

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

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

//emlist[例][ruby]{
require "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#array_nl=(str) (7.0)

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

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

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

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

絞り込み条件を変える

JSON::State#ascii_only? -> bool (7.0)

ASCII 文字列のみを用いて JSON 形式の文字列を生成する場合に真を返します。 そうでない場合に偽を返します。

ASCII 文字列のみを用いて JSON 形式の文字列を生成する場合に真を返します。
そうでない場合に偽を返します。

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

This integer returns the current initial length of the buffer.

This integer returns the current initial length of the buffer.

JSON::State#buffer_initial_length=(length) (7.0)

This sets the initial length of the buffer to length, if length > 0, otherwise its value isn't changed.

This sets the initial length of the buffer to length, if length > 0,
otherwise its value isn't changed.

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

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

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

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

a = [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[0]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]...

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

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

...用するハッシュのキーについては JSON::State.new を参照してください。

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

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

json_state = JSON::State.new(indent: "\t")
json_state.indent # => "\...
...y1: "value1", 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#depth -> Integer (7.0)

This integer returns the current depth of data structure nesting.

This integer returns the current depth of data structure nesting.

JSON::State#depth=(depth) (7.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#generate(obj) -> String (7.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
result. If no valid JSON document can be created this method raises a
GeneratorError exception.

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

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

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

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

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

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

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

...トします。

@param string インデントに使用する文字列を指定します。

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

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

絞り込み条件を変える

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

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

...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_nes...

JSON::State#max_nesting=(depth) (7.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...

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

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

...用するハッシュのキーについては JSON::State.new を参照してください。

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

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

json_state = JSON::State.new(indent: "\t")
json_state.indent # => "\...
...y1: "value1", 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#object_nl -> String (7.0)

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

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

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

json_state = JSON::State.new(object_nl: "\n")
json_state.object_nl...

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

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

...れる JavaScript のオブジェクトの行末に挿入する文字列を指定します。

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

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

絞り込み条件を変える

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

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

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

JSON::State#quirks_mode=(enable) (7.0)

If set to true, enables the quirks_mode mode.

If set to true, enables the quirks_mode mode.

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

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

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

JSON::State#space -> String (7.0)

JSON 形式の文字列のトークン間に挿入する文字列を返します。

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

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

json_state = JSON::State.new(space: "\t")
json_state.space # => "...

JSON::State#space=(string) (7.0)

JSON 形式の文字列のトークン間に挿入する文字列をセットします。

...string JSON 形式の文字列のトークン間に挿入する文字列を指定します。

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

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

絞り込み条件を変える

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

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

...list[例][ruby]{
require "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_befo...

JSON::State#space_before=(string) (7.0)

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

...す部分にある ':' の
前に挿入する文字列をセットします。

//emlist[例][ruby]{
require "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,...

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

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

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

//emlist[例][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,...

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

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

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

//emlist[例][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,...