Class: Legion::Extensions::Agentic::Attention::Kaleidoscope::Helpers::Facet
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Attention::Kaleidoscope::Helpers::Facet
- Defined in:
- lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb
Instance Attribute Summary collapse
-
#angle ⇒ Object
readonly
Returns the value of attribute angle.
-
#brilliance ⇒ Object
Returns the value of attribute brilliance.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#facet_type ⇒ Object
readonly
Returns the value of attribute facet_type.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#transparency ⇒ Object
Returns the value of attribute transparency.
Instance Method Summary collapse
- #brilliance_label ⇒ Object
- #clear? ⇒ Boolean
- #dark? ⇒ Boolean
- #dazzling? ⇒ Boolean
-
#initialize(facet_type:, domain:, content:, brilliance: nil, transparency: nil, angle: nil) ⇒ Facet
constructor
A new instance of Facet.
- #opaque? ⇒ Boolean
- #polish!(rate: 0.1) ⇒ Object
- #rotate!(degrees: Constants::ROTATION_STEP * 360) ⇒ Object
- #tarnish!(rate: Constants::DECAY_RATE) ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(facet_type:, domain:, content:, brilliance: nil, transparency: nil, angle: nil) ⇒ Facet
Returns a new instance of Facet.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 14 def initialize(facet_type:, domain:, content:, brilliance: nil, transparency: nil, angle: nil) validate_facet_type!(facet_type) @id = SecureRandom.uuid @facet_type = facet_type.to_sym @domain = domain.to_sym @content = content.to_s @brilliance = (brilliance || 0.7).to_f.clamp(0.0, 1.0).round(10) @transparency = (transparency || 0.5).to_f.clamp(0.0, 1.0).round(10) @angle = (angle || 0.0).to_f.clamp(0.0, 360.0).round(10) @created_at = Time.now.utc end |
Instance Attribute Details
#angle ⇒ Object (readonly)
Returns the value of attribute angle.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 10 def angle @angle end |
#brilliance ⇒ Object
Returns the value of attribute brilliance.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 12 def brilliance @brilliance end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 10 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 10 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 10 def domain @domain end |
#facet_type ⇒ Object (readonly)
Returns the value of attribute facet_type.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 10 def facet_type @facet_type end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 10 def id @id end |
#transparency ⇒ Object
Returns the value of attribute transparency.
12 13 14 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 12 def transparency @transparency end |
Instance Method Details
#brilliance_label ⇒ Object
55 56 57 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 55 def brilliance_label Constants.label_for(Constants::BRILLIANCE_LABELS, @brilliance) end |
#clear? ⇒ Boolean
51 52 53 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 51 def clear? @transparency >= 0.8 end |
#dark? ⇒ Boolean
43 44 45 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 43 def dark? @brilliance < 0.2 end |
#dazzling? ⇒ Boolean
39 40 41 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 39 def dazzling? @brilliance >= Constants::BRILLIANCE_THRESHOLD end |
#opaque? ⇒ Boolean
47 48 49 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 47 def opaque? @transparency < 0.2 end |
#polish!(rate: 0.1) ⇒ Object
31 32 33 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 31 def polish!(rate: 0.1) @brilliance = (@brilliance + rate.abs).clamp(0.0, 1.0).round(10) end |
#rotate!(degrees: Constants::ROTATION_STEP * 360) ⇒ Object
27 28 29 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 27 def rotate!(degrees: Constants::ROTATION_STEP * 360) @angle = ((@angle + degrees.abs) % 360.0).round(10) end |
#tarnish!(rate: Constants::DECAY_RATE) ⇒ Object
35 36 37 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 35 def tarnish!(rate: Constants::DECAY_RATE) @brilliance = (@brilliance - rate.abs).clamp(0.0, 1.0).round(10) end |
#to_h ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/legion/extensions/agentic/attention/kaleidoscope/helpers/facet.rb', line 59 def to_h { id: @id, facet_type: @facet_type, domain: @domain, content: @content, brilliance: @brilliance, transparency: @transparency, angle: @angle, brilliance_label: brilliance_label, dazzling: dazzling?, dark: dark?, created_at: @created_at } end |