Sha256: 008514d3174f3661674b0adc12e22da504d1d785246940de8079271c59c7121b
Contents?: true
Size: 961 Bytes
Versions: 7
Compression:
Stored size: 961 Bytes
Contents
require 'rom/support/constants' require 'rom/support/class_builder' module ROM module ConfigurationDSL # Setup DSL-specific mapper extensions # # @private class Mapper # Generate a mapper subclass # # This is used by Setup#mappers DSL # # @api private def self.build_class(name, mapper_registry, options = EMPTY_HASH, &block) class_name = "ROM::Mapper[#{name}]" parent = options[:parent] inherit_header = options.fetch(:inherit_header) { ROM::Mapper.inherit_header } parent_class = if parent mapper_registry.detect { |klass| klass.relation == parent } else ROM::Mapper end ClassBuilder.new(name: class_name, parent: parent_class).call do |klass| klass.relation(name) klass.inherit_header(inherit_header) klass.class_eval(&block) if block end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems