Class: Legion::Extensions::Agentic::Memory::ImmuneMemory::Helpers::Encounter
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Memory::ImmuneMemory::Helpers::Encounter
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb
Constant Summary
Constants included from Constants
Constants::B_CELL_ACTIVATION_THRESHOLD, Constants::B_CELL_ANTIBODY_PRODUCTION, Constants::B_CELL_BOOST, Constants::B_CELL_DECAY, Constants::CELL_TYPES, Constants::HEALTH_LABELS, Constants::IMMUNITY_LABELS, Constants::MATURITY_LABELS, Constants::MAX_ANTIBODY_LIBRARY, Constants::MAX_ENCOUNTERS, Constants::MAX_MEMORY_CELLS, Constants::MEMORY_RECOGNITION_THRESHOLD, Constants::PRIMARY_RESPONSE_SPEED, Constants::RESPONSE_SPEED_LABELS, Constants::SECONDARY_RESPONSE_SPEED, Constants::THREAT_TYPES, Constants::T_CELL_ACTIVATION_THRESHOLD, Constants::T_CELL_BOOST, Constants::T_CELL_DECAY, Constants::T_CELL_LIFESPAN, Constants::VACCINATION_STRENGTH
Instance Attribute Summary collapse
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#outcome ⇒ Object
readonly
Returns the value of attribute outcome.
-
#response_speed ⇒ Object
readonly
Returns the value of attribute response_speed.
-
#response_type ⇒ Object
readonly
Returns the value of attribute response_type.
-
#severity ⇒ Object
readonly
Returns the value of attribute severity.
-
#threat_signature ⇒ Object
readonly
Returns the value of attribute threat_signature.
-
#threat_type ⇒ Object
readonly
Returns the value of attribute threat_type.
Instance Method Summary collapse
- #critical? ⇒ Boolean
- #evaded? ⇒ Boolean
-
#initialize(threat_type:, threat_signature:, severity: 0.5, response_type: :primary, response_speed: PRIMARY_RESPONSE_SPEED, outcome: :neutralized) ⇒ Encounter
constructor
A new instance of Encounter.
- #neutralized? ⇒ Boolean
- #primary? ⇒ Boolean
- #secondary? ⇒ Boolean
- #to_h ⇒ Object
Methods included from Constants
Constructor Details
#initialize(threat_type:, threat_signature:, severity: 0.5, response_type: :primary, response_speed: PRIMARY_RESPONSE_SPEED, outcome: :neutralized) ⇒ Encounter
Returns a new instance of Encounter.
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 17 def initialize(threat_type:, threat_signature:, severity: 0.5, response_type: :primary, response_speed: PRIMARY_RESPONSE_SPEED, outcome: :neutralized) @id = SecureRandom.uuid @threat_type = threat_type.to_sym @threat_signature = threat_signature.to_s @severity = severity.to_f.clamp(0.0, 1.0) @response_type = response_type.to_sym @response_speed = response_speed.to_f.round(10) @outcome = outcome.to_sym @created_at = Time.now end |
Instance Attribute Details
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def created_at @created_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def id @id end |
#outcome ⇒ Object (readonly)
Returns the value of attribute outcome.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def outcome @outcome end |
#response_speed ⇒ Object (readonly)
Returns the value of attribute response_speed.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def response_speed @response_speed end |
#response_type ⇒ Object (readonly)
Returns the value of attribute response_type.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def response_type @response_type end |
#severity ⇒ Object (readonly)
Returns the value of attribute severity.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def severity @severity end |
#threat_signature ⇒ Object (readonly)
Returns the value of attribute threat_signature.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def threat_signature @threat_signature end |
#threat_type ⇒ Object (readonly)
Returns the value of attribute threat_type.
14 15 16 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 14 def threat_type @threat_type end |
Instance Method Details
#critical? ⇒ Boolean
33 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 33 def critical? = @severity >= 0.8 |
#evaded? ⇒ Boolean
32 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 32 def evaded? = @outcome == :evaded |
#neutralized? ⇒ Boolean
31 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 31 def neutralized? = @outcome == :neutralized |
#primary? ⇒ Boolean
30 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 30 def primary? = @response_type == :primary |
#secondary? ⇒ Boolean
29 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 29 def secondary? = @response_type == :secondary |
#to_h ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/legion/extensions/agentic/memory/immune_memory/helpers/encounter.rb', line 35 def to_h { id: @id, threat_type: @threat_type, threat_signature: @threat_signature, severity: @severity, response_type: @response_type, response_speed: @response_speed, outcome: @outcome, critical: critical?, created_at: @created_at.iso8601 } end |