Class: Jast::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/jast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_version: 1, base_path: nil) ⇒ Generator

Returns a new instance of Generator.



8
9
10
11
# File 'lib/jast.rb', line 8

def initialize api_version: 1, base_path: nil
  @api_version = api_version
  @base_path = base_path.nil? ? "spec/support/api/v#{api_version}/schemas/" : base_path
end

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



6
7
8
# File 'lib/jast.rb', line 6

def api_version
  @api_version
end

#base_pathObject

Returns the value of attribute base_path.



6
7
8
# File 'lib/jast.rb', line 6

def base_path
  @base_path
end

#definitions_pathObject

Returns the value of attribute definitions_path.



6
7
8
# File 'lib/jast.rb', line 6

def definitions_path
  @definitions_path
end

Instance Method Details

#render_schemas(name, properties, required) ⇒ Object



13
14
15
16
# File 'lib/jast.rb', line 13

def render_schemas name, properties, required
  schema_renderer = Jast::SchemaRenderer.new name, base_path
  schema_renderer.render_resource properties, required
end