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.32.0 lib/avromatic/model/value_object.rb
avromatic-0.32.0.rc0 lib/avromatic/model/value_object.rb
avromatic-0.31.0 lib/avromatic/model/value_object.rb
avromatic-0.30.0 lib/avromatic/model/value_object.rb
avromatic-0.29.1 lib/avromatic/model/value_object.rb
avromatic-0.29.0 lib/avromatic/model/value_object.rb
avromatic-0.28.1 lib/avromatic/model/value_object.rb
avromatic-0.27.0 lib/avromatic/model/value_object.rb
avromatic-0.26.0 lib/avromatic/model/value_object.rb
avromatic-0.25.0 lib/avromatic/model/value_object.rb
avromatic-0.24.0 lib/avromatic/model/value_object.rb
avromatic-0.23.0 lib/avromatic/model/value_object.rb
avromatic-0.22.0 lib/avromatic/model/value_object.rb
avromatic-0.21.1 lib/avromatic/model/value_object.rb
avromatic-0.21.0 lib/avromatic/model/value_object.rb
avromatic-0.21.0.rc1 lib/avromatic/model/value_object.rb
avromatic-0.21.0.rc0 lib/avromatic/model/value_object.rb
avromatic-0.20.0 lib/avromatic/model/value_object.rb
avromatic-0.19.0 lib/avromatic/model/value_object.rb
avromatic-0.18.1 lib/avromatic/model/value_object.rb