Module: Jsonschema::Recorder
- Defined in:
- lib/jsonschema/recorder.rb,
lib/jsonschema/recorder/version.rb
Overview
Recorder
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
'0.1.1'
Class Method Summary collapse
-
.call(path:, name:, content:) ⇒ Object
Your code goes here…
Class Method Details
.call(path:, name:, content:) ⇒ Object
Your code goes here…
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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 |