これは、次のような sample.json ファイルです
{
"name": "Jack (\"Bee\") Nimble",
"format": {
"shape": "rect",
"width": 1920,
"height": 1080,
"interlace": false,
"framerate": 24
}
}
spec ファイルでは、sample.json ファイルが開かれています。
describe Samplespec do
before :all do
@jsonfile = File.open('sample.json').read
@file_json = Samplespec.new(@jsonfile)
end
これをsample.rbファイルに書きました
require 'json'
def initialize(val)
@parsed_val = JSON.parse(val)
end
これはうまくいかないようです。助けてください。ありがとうございました