22件ヒット
[1-22件を表示]
(0.092秒)
検索結果
-
JSON
. create _ id -> String (18108.0) -
json_create メソッドで使用するクラスを決定するために使用する値を返します。
...e)
@id, @name = id, name
end
def self.json_create(object)
new(object['id'], object["name"])
end
def as_json(*)
{
JSON.create_id => self.class.name,
"id" => id,
"name" => name,
}
end
def to_json(*)
as_json.to_json
end
end
json = JSON.generate(Us... -
JSON
. create _ id=(identifier) (6120.0) -
json_create メソッドで使用するクラスを決定するために使用する値をセットします。
...][ruby]{
require "json"
require "json/add/core"
JSON.create_id # => "json_class"
puts (1..5).to_json # => {"json_class":"Range","a":[1,5,false]}
JSON.create_id = "my_json_class" # => "my_json_class"
JSON.create_id # => "my_json_class"
puts (1..5).to_...