12件ヒット
[1-12件を表示]
(0.306秒)
ライブラリ
- json (12)
クラス
-
JSON
:: Parser (12)
検索結果
-
JSON
:: Parser . new(source , options => {}) -> JSON :: Parser (19.0) -
パーサを初期化します。
...。
: :array_class
JSON の配列を変換するクラスを指定します。デフォルトは Array です。
@param source パーサの元となる文字列を指定します。
@param options オプションを指定するためのハッシュです。
//emlist[例][ruby]{
require 'json'......}
//}
//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 # => Person
pe...