Module: Strict::Value

Defined in:
lib/strict/value.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



5
6
7
# File 'lib/strict/value.rb', line 5

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

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


13
14
15
# File 'lib/strict/value.rb', line 13

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

#hashObject



18
19
20
# File 'lib/strict/value.rb', line 18

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

#with(**attributes) ⇒ Object



9
10
11
# File 'lib/strict/value.rb', line 9

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