Sha256: 8b9b87f91c6218e1fc63dfa260a30c660cb53018cc8932c539f626935844a1ef

Contents?: true

Size: 951 Bytes

Versions: 1

Compression:

Stored size: 951 Bytes

Contents

module SequelMapper
  class RelationMapping
    def initialize(name:, namespace:, fields:, primary_key:, factory:, serializer:, associations:, subsets:)
      @name = name
      @namespace = namespace
      @fields = fields
      @primary_key = primary_key
      @factory = factory
      @serializer = serializer
      @associations = associations
      @subsets = subsets
    end

    attr_reader :name, :namespace, :fields, :primary_key, :factory, :serializer, :associations, :subsets

    def add_association(name, new_association)
      @associations = associations.merge(name => new_association)
    end

    private

    def new_with_associations(new_associations)
      self.class.new(
        name: name,
        namespace: namespace,
        fields: fields,
        primary_key: primary_key,
        factory: factory,
        serializer: serializer,
        associations: new_associations,
        subsets: subsets,
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sequel_mapper-0.0.3 lib/sequel_mapper/relation_mapping.rb