Class: ClaudeMemory::Core::FactId

Inherits:
Object
  • Object
show all
Defined in:
lib/claude_memory/core/fact_id.rb

Overview

Value object representing a fact identifier Provides type safety and validation for fact IDs (positive integers)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ FactId

Returns a new instance of FactId.



10
11
12
13
14
# File 'lib/claude_memory/core/fact_id.rb', line 10

def initialize(value)
  @value = value.to_i
  validate!
  freeze
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8
9
10
# File 'lib/claude_memory/core/fact_id.rb', line 8

def value
  @value
end

Instance Method Details

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



24
25
26
# File 'lib/claude_memory/core/fact_id.rb', line 24

def ==(other)
  other.is_a?(FactId) && other.value == value
end

#hashObject



30
31
32
# File 'lib/claude_memory/core/fact_id.rb', line 30

def hash
  value.hash
end

#to_iObject



16
17
18
# File 'lib/claude_memory/core/fact_id.rb', line 16

def to_i
  value
end

#to_sObject



20
21
22
# File 'lib/claude_memory/core/fact_id.rb', line 20

def to_s
  value.to_s
end