Sha256: 2eb584dee282050672f6d907aadb2abda47f0beb22ae1c7923a18e5cd9699c61

Contents?: true

Size: 848 Bytes

Versions: 14

Compression:

Stored size: 848 Bytes

Contents

# frozen_string_literal: true

#
# Copyright (c) 2019-present, Blue Marble Payroll, LLC
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

require_relative 'base'

module Dbee
  class Model
    class Constraints
      # A Reference constraint is a constraint between two data models.  In DB terms:
      # the name represents the column name on the child and the parent represents the
      # column name on the parent table.
      class Reference < Base
        attr_reader :parent

        def initialize(name:, parent:)
          raise ArgumentError, 'name is required' if name.to_s.empty?
          raise ArgumentError, 'parent is required' if parent.to_s.empty?

          super(name: name, parent: parent)

          freeze
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
dbee-3.1.0 lib/dbee/model/constraints/reference.rb
dbee-3.0.0 lib/dbee/model/constraints/reference.rb
dbee-2.1.1 lib/dbee/model/constraints/reference.rb
dbee-2.1.0 lib/dbee/model/constraints/reference.rb
dbee-2.1.0.pre.alpha lib/dbee/model/constraints/reference.rb
dbee-2.0.3 lib/dbee/model/constraints/reference.rb
dbee-2.0.2 lib/dbee/model/constraints/reference.rb
dbee-2.0.1 lib/dbee/model/constraints/reference.rb
dbee-2.0.0 lib/dbee/model/constraints/reference.rb
dbee-2.0.0.pre.alpha lib/dbee/model/constraints/reference.rb
dbee-1.2.1 lib/dbee/model/constraints/reference.rb
dbee-1.2.0 lib/dbee/model/constraints/reference.rb
dbee-1.1.0 lib/dbee/model/constraints/reference.rb
dbee-1.0.3 lib/dbee/model/constraints/reference.rb