Class: Legion::Extensions::Agentic::Attention::Telescope::Helpers::Observation
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Telescope::Helpers::Observation
- Defined in:
- lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb
Instance Attribute Summary collapse
-
#detail_level ⇒ Object
readonly
Returns the value of attribute detail_level.
-
#distance ⇒ Object
readonly
Returns the value of attribute distance.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#recorded_at ⇒ Object
readonly
Returns the value of attribute recorded_at.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#telescope_id ⇒ Object
readonly
Returns the value of attribute telescope_id.
Instance Method Summary collapse
- #distance_label ⇒ Object
-
#faint? ⇒ Boolean
True when detail is too faint to interpret.
-
#initialize(telescope_id:, target:, distance:, telescope_magnification: 1.0) ⇒ Observation
constructor
A new instance of Observation.
-
#significant? ⇒ Boolean
True when detail is strong enough to be actionable.
- #to_h ⇒ Object
Constructor Details
#initialize(telescope_id:, target:, distance:, telescope_magnification: 1.0) ⇒ Observation
Returns a new instance of Observation.
13 14 15 16 17 18 19 20 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 13 def initialize(telescope_id:, target:, distance:, telescope_magnification: 1.0) @id = SecureRandom.uuid @telescope_id = telescope_id @target = target.to_s @distance = distance.to_f.clamp(0.0, 1.0).round(10) @detail_level = compute_detail(telescope_magnification) @recorded_at = Time.now.utc end |
Instance Attribute Details
#detail_level ⇒ Object (readonly)
Returns the value of attribute detail_level.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 10 def detail_level @detail_level end |
#distance ⇒ Object (readonly)
Returns the value of attribute distance.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 10 def distance @distance end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 10 def id @id end |
#recorded_at ⇒ Object (readonly)
Returns the value of attribute recorded_at.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 10 def recorded_at @recorded_at end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 10 def target @target end |
#telescope_id ⇒ Object (readonly)
Returns the value of attribute telescope_id.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 10 def telescope_id @telescope_id end |
Instance Method Details
#distance_label ⇒ Object
32 33 34 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 32 def distance_label Helpers::Constants.label_for(Constants::DISTANCE_LABELS, @distance) end |
#faint? ⇒ Boolean
True when detail is too faint to interpret
28 29 30 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 28 def faint? @detail_level < 0.3 end |
#significant? ⇒ Boolean
True when detail is strong enough to be actionable
23 24 25 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 23 def significant? @detail_level >= 0.7 end |
#to_h ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/legion/extensions/agentic/attention/telescope/helpers/observation.rb', line 36 def to_h { id: @id, telescope_id: @telescope_id, target: @target, distance: @distance, distance_label: distance_label, detail_level: @detail_level, significant: significant?, faint: faint?, recorded_at: @recorded_at } end |