るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.180秒)
トップページ > クエリ:i[x] > クエリ:A[x] > クエリ:user[x] > クエリ:create_id[x]

別のキーワード

  1. rubygems/user_interaction new
  2. rubygems/user_interaction done
  3. rubygems/user_interaction count
  4. rubygems/user_interaction updated
  5. http proxy_user

ライブラリ

モジュール

検索結果

JSON.create_id -> String (30331.0)

json_create メソッドで使用するクラスを決定するために使用する値を返します。

...on_create メソッドで使用するクラスを決定するために使用する値を返します。

デフォルトは "json_class" です。

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

class User
a
ttr :id, :name
def initialize(id, name)
@id, @name = id, name
end

def self.json_create(obj...
...id'], object["name"])
end

def as_json(*)
{
JSON.create_id => self.class.name,
"id" => id,
"name" => name,
}
end

def to_json(*)
a
s_json.to_json
end
end

json = JSON.generate(User.new(1, "tanaka"))
json # => "{\"json_class\":\"User\",\"id\":1,\"name\":\"tanaka...
...\"}"
JSON.parse(json, create_additions: true)
# => #<User:0x0000557709b269e0 @id=1, @name="tanaka">
//}...