module Inspec::Schema::OutputSchema

Constants

LIST
PLATFORMS

using a proc here so we can lazy load it when we need

Public Class Methods

build_definitions(schema_type) click to toggle source

Build our definitions

# File lib/inspec/schema/output_schema.rb, line 11
def self.build_definitions(schema_type)
  {
    "definitions" => schema_type.all_depends.map { |t| [t.ref_name, t.body] }.to_h,
  }
end
finalize(schema_type) click to toggle source

Helper function to automatically bundle a type with its dependencies

# File lib/inspec/schema/output_schema.rb, line 18
def self.finalize(schema_type)
  schema_type.body.merge(OutputSchema.build_definitions(schema_type))
end
json(name) click to toggle source
# File lib/inspec/schema/output_schema.rb, line 40
def self.json(name)
  if !LIST.key?(name)
    raise("Cannot find schema #{name.inspect}.")
  elsif LIST[name].is_a?(Proc)
    v = LIST[name].call
  else
    v = LIST[name]
  end

  JSON.dump(v)
end
names() click to toggle source
# File lib/inspec/schema/output_schema.rb, line 36
def self.names
  LIST.keys
end