Class: Legion::Extensions::Agentic::Integration::Mycelium::Helpers::FruitingBody
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Integration::Mycelium::Helpers::FruitingBody
- Defined in:
- lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#emerged_at ⇒ Object
readonly
Returns the value of attribute emerged_at.
-
#fruiting_type ⇒ Object
readonly
Returns the value of attribute fruiting_type.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#potency ⇒ Object
readonly
Returns the value of attribute potency.
-
#source_node_id ⇒ Object
readonly
Returns the value of attribute source_node_id.
Instance Method Summary collapse
-
#initialize(fruiting_type:, source_node_id:, content:, potency: 0.5) ⇒ FruitingBody
constructor
A new instance of FruitingBody.
- #to_h ⇒ Object
Constructor Details
#initialize(fruiting_type:, source_node_id:, content:, potency: 0.5) ⇒ FruitingBody
Returns a new instance of FruitingBody.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 13 def initialize(fruiting_type:, source_node_id:, content:, potency: 0.5) validate_type!(fruiting_type) @id = SecureRandom.uuid @fruiting_type = fruiting_type.to_sym @source_node_id = source_node_id @content = content.to_s @potency = potency.to_f.clamp(0.0, 1.0).round(10) @emerged_at = Time.now.utc end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 10 def content @content end |
#emerged_at ⇒ Object (readonly)
Returns the value of attribute emerged_at.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 10 def emerged_at @emerged_at end |
#fruiting_type ⇒ Object (readonly)
Returns the value of attribute fruiting_type.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 10 def fruiting_type @fruiting_type end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 10 def id @id end |
#potency ⇒ Object (readonly)
Returns the value of attribute potency.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 10 def potency @potency end |
#source_node_id ⇒ Object (readonly)
Returns the value of attribute source_node_id.
10 11 12 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 10 def source_node_id @source_node_id end |
Instance Method Details
#to_h ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/legion/extensions/agentic/integration/mycelium/helpers/fruiting_body.rb', line 24 def to_h { id: @id, fruiting_type: @fruiting_type, source_node_id: @source_node_id, content: @content, potency: @potency, emerged_at: @emerged_at } end |