module Jsonschema::Recorder
Constants
- VERSION
Public Class Methods
call(path:, name:, content:)
click to toggle source
Your code goes hereā¦
# File lib/jsonschema/recorder.rb, line 11 def self.call(path:, name:, content:) json_schema = Jsonschema::Generator.call(content) file_name = "#{name}.json" snap_path = File.join(path, file_name) unless Dir.exist?(File.dirname(snap_path)) FileUtils.mkdir_p(File.dirname(snap_path)) end file = File.new(snap_path, 'w+') file.write(json_schema.to_json) file.close end