Class: Legion::Extensions::Agentic::Self::NarrativeArc::Helpers::BeatEvent
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Self::NarrativeArc::Helpers::BeatEvent
- Defined in:
- lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb
Instance Attribute Summary collapse
-
#beat_id ⇒ Object
readonly
Returns the value of attribute beat_id.
-
#beat_type ⇒ Object
readonly
Returns the value of attribute beat_type.
-
#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.
-
#emotional_charge ⇒ Object
readonly
Returns the value of attribute emotional_charge.
-
#intensity ⇒ Object
readonly
Returns the value of attribute intensity.
Instance Method Summary collapse
- #climactic? ⇒ Boolean
-
#initialize(content:, intensity: 0.5, beat_type: :rising_action, domain: :general, emotional_charge: 0.0) ⇒ BeatEvent
constructor
A new instance of BeatEvent.
- #resolving? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(content:, intensity: 0.5, beat_type: :rising_action, domain: :general, emotional_charge: 0.0) ⇒ BeatEvent
Returns a new instance of BeatEvent.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 15 def initialize(content:, intensity: 0.5, beat_type: :rising_action, domain: :general, emotional_charge: 0.0) @beat_id = SecureRandom.uuid @content = content @intensity = intensity.clamp(0.0, 1.0) @beat_type = validate_beat_type(beat_type) @domain = domain @emotional_charge = emotional_charge.clamp(-1.0, 1.0) @created_at = Time.now.utc end |
Instance Attribute Details
#beat_id ⇒ Object (readonly)
Returns the value of attribute beat_id.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 12 def beat_id @beat_id end |
#beat_type ⇒ Object (readonly)
Returns the value of attribute beat_type.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 12 def beat_type @beat_type end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 12 def content @content end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 12 def created_at @created_at end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 12 def domain @domain end |
#emotional_charge ⇒ Object (readonly)
Returns the value of attribute emotional_charge.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 12 def emotional_charge @emotional_charge end |
#intensity ⇒ Object (readonly)
Returns the value of attribute intensity.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 12 def intensity @intensity end |
Instance Method Details
#climactic? ⇒ Boolean
38 39 40 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 38 def climactic? @beat_type == :climax || @intensity >= Constants::CLIMAX_THRESHOLD end |
#resolving? ⇒ Boolean
42 43 44 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 42 def resolving? %i[falling_action resolution denouement].include?(@beat_type) end |
#to_h ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/legion/extensions/agentic/self/narrative_arc/helpers/beat_event.rb', line 26 def to_h { beat_id: @beat_id, content: @content, intensity: @intensity, beat_type: @beat_type, domain: @domain, emotional_charge: @emotional_charge, created_at: @created_at } end |