Class: Prmd::Generator
- Inherits:
-
Object
- Object
- Prmd::Generator
- Defined in:
- lib/prmd/core/generator.rb
Overview
Schema generator
Instance Method Summary collapse
- #generate(options = {}) ⇒ Object
-
#initialize(properties = {}) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(properties = {}) ⇒ Generator
Returns a new instance of Generator.
10 11 12 13 14 |
# File 'lib/prmd/core/generator.rb', line 10 def initialize(properties = {}) @properties = properties @base = properties.fetch(:base, {}) @template = properties.fetch(:template) end |
Instance Method Details
#generate(options = {}) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/prmd/core/generator.rb', line 18 def generate( = {}) res = @template.result() resource_schema = JSON.parse(res) schema = Prmd::Schema.new schema.merge!(@base) schema.merge!(resource_schema) schema end |