Class: Legion::Extensions::Agentic::Defense::Phantom::Helpers::PhantomSignal
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Defense::Phantom::Helpers::PhantomSignal
- Defined in:
- lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#intensity_at_trigger ⇒ Object
readonly
Returns the value of attribute intensity_at_trigger.
-
#phantom_limb_id ⇒ Object
readonly
Returns the value of attribute phantom_limb_id.
-
#stimulus ⇒ Object
readonly
Returns the value of attribute stimulus.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#trigger_type ⇒ Object
readonly
Returns the value of attribute trigger_type.
Instance Method Summary collapse
-
#initialize(phantom_limb_id:, stimulus:, trigger_type:, intensity_at_trigger:) ⇒ PhantomSignal
constructor
A new instance of PhantomSignal.
- #to_h ⇒ Object
Constructor Details
#initialize(phantom_limb_id:, stimulus:, trigger_type:, intensity_at_trigger:) ⇒ PhantomSignal
Returns a new instance of PhantomSignal.
15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 15 def initialize(phantom_limb_id:, stimulus:, trigger_type:, intensity_at_trigger:) @id = SecureRandom.uuid @phantom_limb_id = phantom_limb_id @stimulus = stimulus @trigger_type = trigger_type @intensity_at_trigger = intensity_at_trigger.clamp(0.0, 1.0) @timestamp = Time.now.utc end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 12 def id @id end |
#intensity_at_trigger ⇒ Object (readonly)
Returns the value of attribute intensity_at_trigger.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 12 def intensity_at_trigger @intensity_at_trigger end |
#phantom_limb_id ⇒ Object (readonly)
Returns the value of attribute phantom_limb_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 12 def phantom_limb_id @phantom_limb_id end |
#stimulus ⇒ Object (readonly)
Returns the value of attribute stimulus.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 12 def stimulus @stimulus end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 12 def @timestamp end |
#trigger_type ⇒ Object (readonly)
Returns the value of attribute trigger_type.
12 13 14 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 12 def trigger_type @trigger_type end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/legion/extensions/agentic/defense/phantom/helpers/phantom_signal.rb', line 24 def to_h { id: @id, phantom_limb_id: @phantom_limb_id, stimulus: @stimulus, trigger_type: @trigger_type, intensity_at_trigger: @intensity_at_trigger.round(10), timestamp: @timestamp } end |