Class: Voot::Cue
- Inherits:
-
Object
- Object
- Voot::Cue
- Defined in:
- lib/voot/cue.rb
Instance Attribute Summary collapse
-
#cue_timing ⇒ Object
readonly
Returns the value of attribute cue_timing.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Instance Method Summary collapse
- #has_identifier? ⇒ Boolean
-
#initialize(options = {}) ⇒ Cue
constructor
A new instance of Cue.
- #to_webvtt ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Cue
Returns a new instance of Cue.
7 8 9 10 11 |
# File 'lib/voot/cue.rb', line 7 def initialize( = {}) @identifier = [:identifier] @cue_timing = .fetch(:cue_timing) @payload = .fetch(:payload) end |
Instance Attribute Details
#cue_timing ⇒ Object (readonly)
Returns the value of attribute cue_timing.
5 6 7 |
# File 'lib/voot/cue.rb', line 5 def cue_timing @cue_timing end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
5 6 7 |
# File 'lib/voot/cue.rb', line 5 def identifier @identifier end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
5 6 7 |
# File 'lib/voot/cue.rb', line 5 def payload @payload end |
Instance Method Details
#has_identifier? ⇒ Boolean
13 14 15 |
# File 'lib/voot/cue.rb', line 13 def has_identifier? !identifier.nil? && identifier.length > 0 end |
#to_webvtt ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/voot/cue.rb', line 17 def to_webvtt if has_identifier? "#{identifier}\n#{cue_timing.to_webvtt}\n#{payload}" else "#{cue_timing.to_webvtt}\n#{payload}" end end |