Class: Legion::Extensions::Agentic::Attention::Spotlight::Helpers::AttentionTarget
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Spotlight::Helpers::AttentionTarget
- Includes:
- Constants
- Defined in:
- lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb
Constant Summary
Constants included from Constants
Constants::CAPTURE_THRESHOLD, Constants::DEFAULT_BREADTH, Constants::DEFAULT_INTENSITY, Constants::INTENSITY_GAIN, Constants::INTENSITY_LABELS, Constants::INTENSITY_LOSS, Constants::MAX_PERIPHERAL, Constants::MAX_TARGETS, Constants::MODE_LABELS, Constants::PERIPHERAL_DETECTION_THRESHOLD, Constants::ZOOM_LEVELS, Constants::ZOOM_RANGES, Constants::ZOOM_STEP
Instance Attribute Summary collapse
-
#capture_count ⇒ Object
Returns the value of attribute capture_count.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#in_periphery ⇒ Object
Returns the value of attribute in_periphery.
-
#in_spotlight ⇒ Object
Returns the value of attribute in_spotlight.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#last_attended_at ⇒ Object
Returns the value of attribute last_attended_at.
-
#relevance ⇒ Object
Returns the value of attribute relevance.
-
#salience ⇒ Object
Returns the value of attribute salience.
Instance Method Summary collapse
- #compelling? ⇒ Boolean
-
#initialize(label:, domain:, salience: 0.5, relevance: 0.5) ⇒ AttentionTarget
constructor
A new instance of AttentionTarget.
- #salient? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(label:, domain:, salience: 0.5, relevance: 0.5) ⇒ AttentionTarget
Returns a new instance of AttentionTarget.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 18 def initialize(label:, domain:, salience: 0.5, relevance: 0.5) @id = SecureRandom.uuid @label = label @domain = domain @salience = salience.clamp(0.0, 1.0) @relevance = relevance.clamp(0.0, 1.0) @in_spotlight = false @in_periphery = false @capture_count = 0 @created_at = Time.now.utc @last_attended_at = nil end |
Instance Attribute Details
#capture_count ⇒ Object
Returns the value of attribute capture_count.
15 16 17 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15 def capture_count @capture_count end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14 def id @id end |
#in_periphery ⇒ Object
Returns the value of attribute in_periphery.
15 16 17 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15 def in_periphery @in_periphery end |
#in_spotlight ⇒ Object
Returns the value of attribute in_spotlight.
15 16 17 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15 def in_spotlight @in_spotlight end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
14 15 16 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 14 def label @label end |
#last_attended_at ⇒ Object
Returns the value of attribute last_attended_at.
15 16 17 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15 def last_attended_at @last_attended_at end |
#relevance ⇒ Object
Returns the value of attribute relevance.
15 16 17 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15 def relevance @relevance end |
#salience ⇒ Object
Returns the value of attribute salience.
15 16 17 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 15 def salience @salience end |
Instance Method Details
#compelling? ⇒ Boolean
31 32 33 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 31 def compelling? @salience >= Constants::CAPTURE_THRESHOLD end |
#salient? ⇒ Boolean
35 36 37 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 35 def salient? @salience >= Constants::PERIPHERAL_DETECTION_THRESHOLD end |
#to_h ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/legion/extensions/agentic/attention/spotlight/helpers/attention_target.rb', line 39 def to_h { id: @id, label: @label, domain: @domain, salience: @salience.round(10), relevance: @relevance.round(10), in_spotlight: @in_spotlight, in_periphery: @in_periphery, capture_count: @capture_count, compelling: compelling?, salient: salient?, created_at: @created_at, last_attended_at: @last_attended_at } end |