Sha256: df7d7d6ff4369a9866cbb1f2bd3dec3095b5d03791925453721e924b943fc4a6

Contents?: true

Size: 375 Bytes

Versions: 1

Compression:

Stored size: 375 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Muina
  # Immutable Value Object parent class
  class Entity
    include T::Props
    include T::Props::Constructor

    const :id, Integer

    def serialize
      self.class.props.keys.to_h { |prop| [prop, __send__(prop)] }
    end

    def with(hash = {})
      self.class.new(serialize.merge(hash))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
muina-0.2.8 lib/muina/entity.rb