Ruby 2.6.0 リファレンスマニュアル > ライブラリ一覧 > jsonライブラリ > JSON::Stateクラス

class JSON::State

クラス・モジュールの継承リスト: JSON::State < Object < Kernel < BasicObject
aliases: JSON::Ext::Generator::State

要約

Ruby オブジェクトから JSON 形式の文字列を生成する間、 JSON 形式の文字列を生成するための設定を保持しておくために使用するクラスです。

特異メソッド

定義 説明
from_state(options) -> JSON::State

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

new(options = {}) -> JSON::State

自身を初期化します。

インスタンスメソッド

定義 説明
self[name] -> object

Return the value returned by method name.

self[name] = value

Set the attribute name to value.

allow_nan? -> bool

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

array_nl -> String

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

array_nl=(str)

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

ascii_only? -> bool

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

buffer_initial_length -> Integer

This integer returns the current initial length of the buffer.

buffer_initial_length=(length)

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

check_circular? -> bool

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

configure(options = {}) -> self
merge(options = {}) -> self

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

depth -> Integer

This integer returns the current depth of data structure nesting.

depth=(depth)

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.

generate(obj) -> String

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.

indent -> String

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

indent=(string)

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

max_nesting -> Integer

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

max_nesting=(depth)

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

object_nl -> String

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

object_nl=(string)

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

quirks_mode? -> bool
quirks_mode -> bool

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

quirks_mode=(enable)

If set to true, enables the quirks_mode mode.

space -> String

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

space=(string)

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

space_before -> String

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

space_before=(string)

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

to_h -> Hash
to_hash -> Hash

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

継承したメソッド

! != __id__ __send__ instance_eval instance_exec method_missing singleton_method_added singleton_method_removed singleton_method_undefined !~ <=> == === =~ _dump class clone define_singleton_method display enum_for eql? equal? extend freeze frozen? hash initialize initialize_copy inspect instance_of? instance_variable_defined? instance_variable_get instance_variable_set instance_variables is_a? itself marshal_dump marshal_load method methods nil? object_id pretty_inspect pretty_print pretty_print_cycle pretty_print_inspect pretty_print_instance_variables private_methods protected_methods psych_to_yaml public_method public_methods public_send remove_instance_variable respond_to? respond_to_missing? send singleton_class singleton_method singleton_methods taint tainted? tap then to_a to_ary to_int to_io to_proc to_regexp to_s to_str trust untaint untrust untrusted? .yaml_tag ::ARGF ::ARGV ::DATA ::ENV ::FALSE ::NIL ::RUBY_COPYRIGHT ::RUBY_DESCRIPTION ::RUBY_ENGINE ::RUBY_ENGINE_VERSION ::RUBY_PATCHLEVEL ::RUBY_PLATFORM ::RUBY_RELEASE_DATE ::RUBY_REVISION ::RUBY_VERSION ::SCRIPT_LINES__ ::STDERR ::STDIN ::STDOUT ::TOPLEVEL_BINDING ::TRUE