るりまサーチ (Ruby 2.5.0)

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

別のキーワード

  1. json to_json
  2. json state
  3. json parser
  4. json []
  5. json parse

クラス

検索結果

Kernel#JSON(object, options = {}) -> object (54517.0)

第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。

第一引数に与えられたオブジェクトの種類によって Ruby のオブジェクトか JSON 形式の文字列を返します。

第一引数に文字列のようなオブジェクトを指定した場合は、それを JSON.#parse を用いてパースした結果を返します。
そうでないオブジェクトを指定した場合は、それを JSON.#generate を用いて変換した結果を返します。

@param object 任意のオブジェクトを指定します。

@param options JSON.#parse, JSON.#generate に渡すオプションを指定します。

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

JSON::Generator::GeneratorMethods::String#to_json_raw -> String (27571.0)

自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。

自身に対して JSON::Generator::GeneratorMethods::String#to_json_raw_object を呼び出して JSON::Generator::GeneratorMethods::Hash#to_json した結果を返します。

@see JSON::Generator::GeneratorMethods::String#to_json_raw_object, JSON::Generator::GeneratorMethods::Hash#to_json

JSON::Generator::GeneratorMethods::Object#to_json(state_or_hash = nil) -> String (27499.0)

自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。

自身を to_s で文字列にした結果を JSON 形式の文字列に変換して返します。

このメソッドはあるオブジェクトに to_json メソッドが定義されていない場合に使用する
フォールバックのためのメソッドです。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

//emlist[例][ruby...

JSON::Generator::GeneratorMethods::String#to_json(state_or_hash = nil) -> String (27499.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

自身のエンコードは UTF-8 であるべきです。
"\u????" のように UTF-16 ビッグエンディアンでエンコードされた文字列を返すことがあります。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

//emlist[例][ruby]...

JSON::Generator::GeneratorMethods::Array#to_json(state_or_hash = nil) -> String (27445.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

[1, 2, 3].to_json # => "[1,2,3]"
//}

絞り込み条件を変える

JSON::Generator::GeneratorMethods::FalseClass#to_json(state_or_hash = nil) -> String (27445.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

"false" という文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

false.to_json # => "false"
//}

JSON::Generator::GeneratorMethods::Float#to_json(state_or_hash = nil) -> String (27445.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

(1.0).to_json # => "1.0"
//}

JSON::Generator::GeneratorMethods::Hash#to_json(state_or_hash = nil) -> String (27445.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

person = { "name" => "tanaka", "age" => 19 }
person.to_json # ...

JSON::Generator::GeneratorMethods::Integer#to_json(state_or_hash = nil) -> String (27445.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

10.to_json # => "10"
//}

JSON::Generator::GeneratorMethods::NilClass#to_json(state_or_hash = nil) -> String (27445.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

"null" という文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

nil.to_json # => "null"
//}

絞り込み条件を変える

JSON::Generator::GeneratorMethods::TrueClass#to_json(state_or_hash = nil) -> String (27445.0)

自身から生成した JSON 形式の文字列を返します。

自身から生成した JSON 形式の文字列を返します。

"true" という文字列を返します。

@param state_or_hash 生成する JSON 形式の文字列をカスタマイズするため
に JSON::State のインスタンスか、
JSON::State.new の引数と同じ Hash を
指定します。

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

true.to_json # => "true"
//}

JSON::Generator::GeneratorMethods::String#to_json_raw_object -> Hash (27415.0)

生の文字列を格納したハッシュを生成します。

生の文字列を格納したハッシュを生成します。

このメソッドは UTF-8 の文字列ではなく生の文字列を JSON に変換する場合に使用してください。

require 'json'
"にほんご".encode("euc-jp").to_json_raw_object
# => {"json_class"=>"String", "raw"=>[164, 203, 164, 219, 164, 243, 164, 180]}
"にほんご".encode("euc-jp").to_json # source sequence is illegal/malformed (JSON::...

Date#to_json(*args) -> String (18517.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

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

Date.today.to_json
# => "{\"json_class\":\"Date\",\"y\":2018,\"m\":12...

DateTime#to_json(*args) -> String (18517.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

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

DateTime.now.to_json
# => "{\"json_class\":\"DateTime\",\"y\":2018,\"...

Exception#to_json(*args) -> String (18517.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

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

begin
0/0
rescue => e
e.to_json # => "{\"json_class\":\"ZeroDivis...

絞り込み条件を変える

Range#to_json(*args) -> String (18517.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

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

(1..5).to_json # => "{\"json_class\":\"Range\",\"a\":[1,5,false]}"
//...

Struct#to_json(*args) -> String (18517.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

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

Person = Struct.new(:name, :age)
Person.new("tanaka", 29).to_json # =...

Time#to_json(*args) -> String (18517.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

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

Time.now.to_json # => "{\"json_class\":\"Time\",\"s\":1544968675,\"n\...

BigDecimal#to_json(*args) -> String (18481.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 使用しません。

//emlist[例][ruby]{
require 'json/add/bigdecimal'
BigDecimal('0.123456789123456789').to_json # => "{\"json_class\":\"BigDecimal\",\"b\":\"36:0.123456789123456789e0\"}"
//...

Complex#to_json(*args) -> String (18481.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 使用しません。

//emlist[例][ruby]{
require 'json/add/complex'
Complex(2, 3).to_json # => "{\"json_class\":\"Complex\",\"r\":2,\"i\":3}"
//}

@see JSON::Generator::GeneratorMethods::Hash...

絞り込み条件を変える

Rational#to_json(*args) -> String (18481.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 使用しません。

//emlist[例][ruby]{
require 'json/add/rational'
Rational(1, 3).to_json # => "{\"json_class\":\"Rational\",\"n\":1,\"d\":3}"
//}

@see JSON::Generator::GeneratorMethods::H...

OpenStruct#to_json(*args) -> String (18463.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

@see JSON::Generator::GeneratorMethods::Hash#to_json

Symbol#to_json(*args) -> String (18463.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数はそのまま JSON::Generator::GeneratorMethods::Hash#to_json に渡されます。

@see JSON::Generator::GeneratorMethods::Hash#to_json

Class#json_creatable? -> bool (18445.0)

シリアライズされた JSON 形式の文字列から、インスタンスを作成するのにこのクラスを使用できる場合は 真を返します。そうでない場合は、偽を返します。

シリアライズされた JSON 形式の文字列から、インスタンスを作成するのにこのクラスを使用できる場合は
真を返します。そうでない場合は、偽を返します。

このメソッドが真を返すクラスは json_create というメソッドを実装していなければなりません。
また json_create の第一引数は必要なデータを含むハッシュを期待しています。

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

String.json_creatable? # => true
Dir.json_creatable? # => false
//}

Regexp#to_json(*args) -> String (18445.0)

自身を JSON 形式の文字列に変換して返します。

自身を JSON 形式の文字列に変換して返します。

内部的にはハッシュにデータをセットしてから JSON::Generator::GeneratorMethods::Hash#to_json を呼び出しています。

@param args 引数には何の意味もありません。

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

/0\d{1,4}-\d{1,4}-\d{4}/.to_json # => "{\"json_class\":\"Regexp\",\"o\":0,\"s\":\"0\\\\d{1,4}-\\\\d{1,4}-\\\\d{4}\"}"...

絞り込み条件を変える

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

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

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

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

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

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

...

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

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

生成される 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 # => 3
JSON.g...

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

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

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

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

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

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

@param string 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#space -> String (9250.0)

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

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

絞り込み条件を変える

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

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

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

@param 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":"tanaka","age":19}...

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

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

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,{"name":"tanaka","age":19}]

js...

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

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

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

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

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

json_state = JSON::State.new(space_before: "")
json_state.space_before # => ""
puts JSON.gen...

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

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

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

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

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

//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\...

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

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

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

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

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

//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\...

絞り込み条件を変える

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

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

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

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

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

JSON::State#array_nl -> String (9178.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#indent=(string) (9166.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\":\"value2\"}"
json_state.indent = "...

JSON::State#array_nl=(str) (9160.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#allow_nan? -> bool (9130.0)

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

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

//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#indent -> String (9112.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#generate(obj) -> String (9100.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#to_h -> Hash (9076.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,
# :max_nesting=>100,
# ...

JSON::State#to_hash -> Hash (9076.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,
# :max_nesting=>100,
# ...

JSON::Parser#parse -> object (9058.0)

現在のソースをパースして結果を Ruby のオブジェクトとして返します。

現在のソースをパースして結果を Ruby のオブジェクトとして返します。

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

class Person
attr_accessor :name, :age

def []=(key, value)
instance_variable_set("@#{key}", value)
end
end

parser = JSON::Parser.new(DATA.read, object_class: Person)
person = parser.parse
person.class # => Person
p...

絞り込み条件を変える

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

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

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

JSON::State#depth=(depth) (9052.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::Parser#source -> String (9040.0)

現在のソースのコピーを返します。

現在のソースのコピーを返します。

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

parser = JSON::Parser.new(DATA.read)
print parser.source

# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"suzuki",
# => "age":25
# => }
# => }

__END__
{
"Tanaka": {
...

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

Return the value returned by method name.

Return the value returned by method name.

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

Set the attribute name to value.

Set the attribute name to value.

絞り込み条件を変える

JSON::State#buffer_initial_length -> Integer (9004.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) (9004.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#depth -> Integer (9004.0)

This integer returns the current depth of data structure nesting.

This integer returns the current depth of data structure nesting.

JSON::State#quirks_mode -> bool (9004.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) (9004.0)

If set to true, enables the quirks_mode mode.

If set to true, enables the quirks_mode mode.

絞り込み条件を変える

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

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

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

RDoc::Generator::JsonIndex#generate -> () (9004.0)

解析した情報を RDoc::Generator::JsonIndex::SEARCH_INDEX_FILE に出 力します。

解析した情報を RDoc::Generator::JsonIndex::SEARCH_INDEX_FILE に出
力します。

Kernel#j(*objects) -> nil (88.0)

与えられたオブジェクトを JSON 形式の文字列で標準出力に一行で出力します。

与えられたオブジェクトを JSON 形式の文字列で標準出力に一行で出力します。

@param objects JSON 形式で出力したいオブジェクトを指定します。

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

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

@see Kernel.#p

Kernel#jj(*objects) -> nil (88.0)

与えられたオブジェクトを JSON 形式の文字列で標準出力に人間に読みやすく整形して出力します。

与えられたオブジェクトを JSON 形式の文字列で標準出力に人間に読みやすく整形して出力します。

@param objects JSON 形式で出力したいオブジェクトを指定します。

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

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

@see Kernel.#pp

Object#yield_self -> Enumerator (40.0)

self を引数としてブロックを評価し、ブロックの結果を返します。

self を引数としてブロックを評価し、ブロックの結果を返します。

//emlist[例][ruby]{
"my string".yield_self {|s| s.upcase } # => "MY STRING"
3.next.yield_self {|x| x**x }.to_s # => "256"
//}

値をメソッドチェインのパイプラインに次々と渡すのは良い使い方です。

//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'

construct_url(arguments).
...

絞り込み条件を変える

Object#yield_self {|x| ... } -> object (40.0)

self を引数としてブロックを評価し、ブロックの結果を返します。

self を引数としてブロックを評価し、ブロックの結果を返します。

//emlist[例][ruby]{
"my string".yield_self {|s| s.upcase } # => "MY STRING"
3.next.yield_self {|x| x**x }.to_s # => "256"
//}

値をメソッドチェインのパイプラインに次々と渡すのは良い使い方です。

//emlist[メソッドチェインのパイプライン][ruby]{
require 'open-uri'
require 'json'

construct_url(arguments).
...