Class: Legion::Extensions::Agentic::Self::NarrativeIdentity::Helpers::Chapter
- Inherits:
-
Object
- Object
- Legion::Extensions::Agentic::Self::NarrativeIdentity::Helpers::Chapter
- Defined in:
- lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb
Instance Attribute Summary collapse
-
#end_time ⇒ Object
Returns the value of attribute end_time.
-
#episode_ids ⇒ Object
readonly
Returns the value of attribute episode_ids.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #current? ⇒ Boolean
- #episode_count ⇒ Object
-
#initialize(title:, label:, episode_ids: nil, start_time: nil, end_time: nil, id: nil) ⇒ Chapter
constructor
A new instance of Chapter.
- #to_h ⇒ Object
Constructor Details
#initialize(title:, label:, episode_ids: nil, start_time: nil, end_time: nil, id: nil) ⇒ Chapter
Returns a new instance of Chapter.
15 16 17 18 19 20 21 22 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 15 def initialize(title:, label:, episode_ids: nil, start_time: nil, end_time: nil, id: nil) @id = id || SecureRandom.uuid @title = title @label = label @episode_ids = episode_ids || [] @start_time = start_time || Time.now.utc @end_time = end_time end |
Instance Attribute Details
#end_time ⇒ Object
Returns the value of attribute end_time.
13 14 15 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 13 def end_time @end_time end |
#episode_ids ⇒ Object (readonly)
Returns the value of attribute episode_ids.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 12 def episode_ids @episode_ids end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 12 def id @id end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 12 def label @label end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 12 def start_time @start_time end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
12 13 14 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 12 def title @title end |
Instance Method Details
#current? ⇒ Boolean
24 25 26 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 24 def current? @end_time.nil? end |
#episode_count ⇒ Object
28 29 30 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 28 def episode_count @episode_ids.size end |
#to_h ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/legion/extensions/agentic/self/narrative_identity/helpers/chapter.rb', line 32 def to_h { id: @id, title: @title, label: @label, episode_ids: @episode_ids.dup, start_time: @start_time, end_time: @end_time } end |