120件ヒット
[101-120件を表示]
(0.056秒)
別のキーワード
キーワード
- [] (12)
-
create
_ id (12) -
fast
_ unparse (12) -
load
_ file (12) -
load
_ file! (12) - parse! (12)
- parser (12)
-
pretty
_ unparse (12) - unparse (12)
検索結果
-
JSON
. # load _ file(filespec , opts = {}) -> object (47.0) -
filespec で指定した JSON 形式のファイルを Ruby オブジェクトとしてロードして返します。
... JSON 形式のファイルを Ruby オブジェクトとしてロードして返します。
@param filespec ファイル名を指定します。
@param options オプションをハッシュで指定します。指定可能なオプションは JSON.#parse と同様です。
@see JSON.#parse... -
JSON
. create _ id -> String (21.0) -
json_create メソッドで使用するクラスを決定するために使用する値を返します。
...
json_create メソッドで使用するクラスを決定するために使用する値を返します。
デフォルトは "json_class" です。
//emlist[例][ruby]{
require "json"
class User
attr :id, :name
def initialize(id, name)
@id, @name = id, name
end
def self.json_create(......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(User.new(1, "tanaka"))
json # => "{\"json_class\":\"User\",\"id\":1,\"name\":\"tanaka\"}"
JSON.parse(json, create_...