Sha256: 8a23ae8b52d20b84798a744b301edd5e34bd6ecaa1261f4dcfcc7d3d0475a93f

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 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.
#

module Dbee
  class Model
    class Constraints
      # Base class for all constraints.
      class Base
        acts_as_hashable

        attr_reader :name

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

          @name = name.to_s
        end

        def <=>(other)
          name <=> other.name
        end

        def hash
          name.hash
        end

        def ==(other)
          other.name == name
        end
        alias eql? ==
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dbee-1.0.2 lib/dbee/model/constraints/base.rb