Class: ClaudeMemory::Core::FactId
- Inherits:
-
Object
- Object
- ClaudeMemory::Core::FactId
- 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
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(value) ⇒ FactId
constructor
A new instance of FactId.
- #to_i ⇒ Object
- #to_s ⇒ Object
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
#value ⇒ Object (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 |
#hash ⇒ Object
30 31 32 |
# File 'lib/claude_memory/core/fact_id.rb', line 30 def hash value.hash end |
#to_i ⇒ Object
16 17 18 |
# File 'lib/claude_memory/core/fact_id.rb', line 16 def to_i value end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/claude_memory/core/fact_id.rb', line 20 def to_s value.to_s end |