66件ヒット
[1-66件を表示]
(0.020秒)
種類
- インスタンスメソッド (44)
- クラス (11)
- 特異メソッド (11)
クラス
-
JSON
:: Parser (33) -
JSON
:: State (22)
検索結果
先頭5件
-
JSON
:: CircularDatastructure (6002.0) -
JSON 形式の文字列を生成するときに循環するデータ構造があるときに発生する例外です。
...JSON 形式の文字列を生成するときに循環するデータ構造があるときに発生する例外です。... -
JSON
:: State # depth -> Integer (18.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) (18.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 . new(source , options => {}) -> JSON :: Parser (14.0) -
パーサを初期化します。
...も付加情報を生成しません。デフォルトは真です。
: :object_class
JSON のオブジェクトを変換するクラスを指定します。デフォルトは Hash です。
: :array_class
JSON の配列を変換するクラスを指定します。デフォルトは Array です......を指定します。
@param options オプションを指定するためのハッシュです。
//emlist[例][ruby]{
require 'json'
parser = JSON::Parser.new(DATA.read)
print parser.source
# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# =>......5
}
}
//}
//emlist[例 object_class を指定する][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 # => Per... -
JSON
:: Parser # parse -> object (8.0) -
現在のソースをパースして結果を 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 # => Pers......on
person.name # => "tanaka"
person.age # => 20
__END__
{
"name":"tanaka",
"age":20
}
//}
@see JSON::Parser#source... -
JSON
:: Parser # source -> String (8.0) -
現在のソースのコピーを返します。
...現在のソースのコピーを返します。
//emlist[例][ruby]{
require 'json'
parser = JSON::Parser.new(DATA.read)
print parser.source
# => {
# => "Tanaka": {
# => "name":"tanaka",
# => "age":20
# => },
# => "Suzuki": {
# => "name":"suzuki",
# => "age":25
# => }
#...