Sha256: 91beb47670bb0ca15ab332a279506ec6b02bcff271c2ed27024e2dc71e34dd83

Contents?: true

Size: 763 Bytes

Versions: 5

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

#
# Copyright (c) 2018-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 Differential
  module Parser
    # TODO
    class Id
      attr_reader :data, :value

      def initialize(data)
        @data   = Array(data)
        @value  = make_value(data)
      end

      def to_s
        value
      end

      def eql?(other)
        if other.is_a?(self.class)
          value == other.value
        else
          make_value(other) == value
        end
      end

      def ==(other)
        eql?(other)
      end

      private

      def make_value(val)
        Array(val).join(':')
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
differential-1.1.0 lib/differential/parser/id.rb
differential-1.0.6 lib/differential/parser/id.rb
differential-1.0.5 lib/differential/parser/id.rb
differential-1.0.4 lib/differential/parser/id.rb
differential-1.0.3 lib/differential/parser/id.rb