Sha256: 7d0378c56b0e4bae5126aa1df1478c07316626195593b8745c94aa0512d995e4

Contents?: true

Size: 688 Bytes

Versions: 3

Compression:

Stored size: 688 Bytes

Contents

module Chronicle
  module Schema
    module Validation
      module Generation
        @contracts_generated = false

        def self.generate_contracts(graph)
          return if @contracts_generated

          @graph = graph

          graph.types.each do |klass|
            type_id = klass.short_id.to_sym
            type_contract_class = Chronicle::Schema::Validation::ContractFactory.create(type_id:,
              properties: klass.all_properties)

            Chronicle::Schema::Validation.set_contract(type_id, type_contract_class)
          end

          @contracts_generated = true
        end

        def self.graph
          @graph
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chronicle-core-0.3.2 lib/chronicle/schema/validation/generation.rb
chronicle-core-0.3.1 lib/chronicle/schema/validation/generation.rb
chronicle-core-0.3.0 lib/chronicle/schema/validation/generation.rb