Sha256: 38696e41789e41d8ee3df7eb04346e6d464f78baef14c991efb6d7de75faa1a4
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
module Tdc module Generators # # Abstract class for defining generators that define a single model instance. # # See also StandardGenerator. # class SingularGenerator < Tdc::Generators::GeneratorBase include Tdc::Generators::InstanceDefinitionConfigurable def initialize(data_definition, current_catalog) super @additional_definitions = {} end def with_definition(additional_definitions) @additional_definitions = additional_definitions.stringify_keys.reject { |_, v| v == :missing_definition } self end def generate configure_instance_definition(singular_instance_definition.merge(@additional_definitions)) run_resolvers_and_generate_instance end private def singular_instance_definition all_instance_definitions = instance_definitions if all_instance_definitions.many? raise Tdc::FatalError, "For the moment we only generate a single model instance" end # Delete the tag so that the models do not need to filter it out. all_instance_definitions.first.except("tag") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tdc-0.2.2 | lib/tdc/generators/singular_generator.rb |
tdc-0.2.1 | lib/tdc/generators/singular_generator.rb |
tdc-0.2.0 | lib/tdc/generators/singular_generator.rb |