Sha256: f3c46e02aecec25d3299eed303a3a351a84efb2cf143dea227e45d2c4b9708c9

Contents?: true

Size: 386 Bytes

Versions: 7

Compression:

Stored size: 386 Bytes

Contents

# frozen_string_literal: true

module Strict
  module Value
    def self.included(mod)
      mod.extend(Reader::Attributes)
    end

    def with(**attributes)
      self.class.new(**to_h.merge(attributes))
    end

    def eql?(other)
      self.class.equal?(other.class) && to_h.eql?(other.to_h)
    end
    alias == eql?

    def hash
      [self.class, to_h].hash
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
strict-1.5.0 lib/strict/value.rb
strict-1.4.0 lib/strict/value.rb
strict-1.3.1 lib/strict/value.rb
strict-1.3.0 lib/strict/value.rb
strict-1.2.0 lib/strict/value.rb
strict-1.1.0 lib/strict/value.rb
strict-1.0.0 lib/strict/value.rb