Class: L43::Base::DataClass::DataClassClass

Inherits:
Object
  • Object
show all
Defined in:
lib/l43/base/data_class/data_class_class.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



8
9
10
11
# File 'lib/l43/base/data_class/data_class_class.rb', line 8

def ==(other)
  return false unless self.class === other
  other.to_h == to_h
end

#update_attribute(attribute, &blk) ⇒ Object

Raises:

  • (ArgumentError)


13
14
15
16
# File 'lib/l43/base/data_class/data_class_class.rb', line 13

def update_attribute(attribute, &blk)
  raise ArgumentError, "cannot update attribute #{attribute.inspect} without a block" unless blk
  update(attribute => blk.(to_h[attribute]))
end