Class: Legion::Extensions::Agentic::Integration::Zeitgeist::Helpers::CognitiveSignal
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Integration::Zeitgeist::Helpers::CognitiveSignal
- Defined in:
- lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb
Instance Attribute Summary collapse
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#intensity ⇒ Object
readonly
Returns the value of attribute intensity.
-
#source_subsystem ⇒ Object
readonly
Returns the value of attribute source_subsystem.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#valence ⇒ Object
readonly
Returns the value of attribute valence.
Instance Method Summary collapse
-
#initialize(source_subsystem:, domain:, intensity: Constants::DEFAULT_INTENSITY, valence: 0.0, timestamp: nil) ⇒ CognitiveSignal
constructor
A new instance of CognitiveSignal.
- #to_h ⇒ Object
Constructor Details
#initialize(source_subsystem:, domain:, intensity: Constants::DEFAULT_INTENSITY, valence: 0.0, timestamp: nil) ⇒ CognitiveSignal
Returns a new instance of CognitiveSignal.
12 13 14 15 16 17 18 19 20 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 12 def initialize(source_subsystem:, domain:, intensity: Constants::DEFAULT_INTENSITY, valence: 0.0, timestamp: nil) @id = SecureRandom.uuid @source_subsystem = source_subsystem.to_sym @domain = domain.to_sym @intensity = intensity.to_f.clamp(0.0, 1.0) @valence = valence.to_f.clamp(-1.0, 1.0) @timestamp = || Time.now.utc end |
Instance Attribute Details
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 10 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 10 def id @id end |
#intensity ⇒ Object (readonly)
Returns the value of attribute intensity.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 10 def intensity @intensity end |
#source_subsystem ⇒ Object (readonly)
Returns the value of attribute source_subsystem.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 10 def source_subsystem @source_subsystem end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 10 def @timestamp end |
#valence ⇒ Object (readonly)
Returns the value of attribute valence.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 10 def valence @valence end |
Instance Method Details
#to_h ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/legion/extensions/agentic/integration/zeitgeist/helpers/cognitive_signal.rb', line 22 def to_h { id: @id, source_subsystem: @source_subsystem, domain: @domain, intensity: @intensity.round(10), valence: @valence.round(10), timestamp: @timestamp.iso8601 } end |