Sha256: 169594efebaec1640e67c105972714756a398c94442e2e4e8960a66500fe88fb

Contents?: true

Size: 605 Bytes

Versions: 46

Compression:

Stored size: 605 Bytes

Contents

module Avromatic
  module Model
    # This module is used to override the comparisons defined by
    # Virtus::Equalizer which is pulled in by Virtus::ValueObject.
    module ValueObject
      def eql?(other)
        other.instance_of?(self.class) && attributes == other.attributes
      end
      alias_method :==, :eql?

      def hash
        attributes.hash
      end

      def inspect
        "#<#{self.class.name} #{attributes.map { |k, v| "#{k}: #{v.inspect}" }.join(', ')}>"
      end

      def to_s
        format('#<%s:0x00%x>', self.class.name, object_id.abs * 2)
      end
    end
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
avromatic-0.9.0 lib/avromatic/model/value_object.rb
avromatic-0.9.0.rc7 lib/avromatic/model/value_object.rb
avromatic-0.9.0.rc6 lib/avromatic/model/value_object.rb
avromatic-0.9.0.rc4 lib/avromatic/model/value_object.rb
avromatic-0.9.0.rc3 lib/avromatic/model/value_object.rb
avromatic-0.9.0.rc2 lib/avromatic/model/value_object.rb