36件ヒット
[1-36件を表示]
(0.021秒)
クラス
-
JSON
:: Parser (12) -
JSON
:: State (24)
キーワード
- []= (12)
- parse (12)
-
quirks
_ mode= (12)
検索結果
-
JSON
:: State # []=(name , value) (19.0) -
Set the attribute name to value.
...
Set the attribute name to value.... -
JSON
:: State # quirks _ mode=(enable) (19.0) -
If set to true, enables the quirks_mode mode.
...If set to true, enables the quirks_mode mode.... -
JSON
:: Parser # parse -> object (9.0) -
現在のソースをパースして結果を Ruby のオブジェクトとして返します。
...uby のオブジェクトとして返します。
//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
person.name # => "tanaka"
person.age # => 20
__END__
{
"name":"tanaka",
"age":20
}
//}
@see JSON::Parser#source...