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.18.0 lib/avromatic/model/value_object.rb
avromatic-0.18.0.rc0 lib/avromatic/model/value_object.rb
avromatic-0.17.1 lib/avromatic/model/value_object.rb
avromatic-0.17.0 lib/avromatic/model/value_object.rb
avromatic-0.15.1 lib/avromatic/model/value_object.rb
avromatic-0.15.0 lib/avromatic/model/value_object.rb
avromatic-0.15.0.rc0 lib/avromatic/model/value_object.rb
avromatic-0.14.0 lib/avromatic/model/value_object.rb
avromatic-0.14.0.rc1 lib/avromatic/model/value_object.rb
avromatic-0.14.0.rc0 lib/avromatic/model/value_object.rb
avromatic-0.13.0 lib/avromatic/model/value_object.rb
avromatic-0.13.0.rc1 lib/avromatic/model/value_object.rb
avromatic-0.13.0.rc0 lib/avromatic/model/value_object.rb
avromatic-0.12.0 lib/avromatic/model/value_object.rb
avromatic-0.11.2 lib/avromatic/model/value_object.rb
avromatic-0.11.1 lib/avromatic/model/value_object.rb
avromatic-0.11.0 lib/avromatic/model/value_object.rb
avromatic-0.10.0 lib/avromatic/model/value_object.rb
avromatic-0.10.0.rc1 lib/avromatic/model/value_object.rb
avromatic-0.10.0.rc0 lib/avromatic/model/value_object.rb