Class: M3u8::PlaybackStart
- Inherits:
-
Object
- Object
- M3u8::PlaybackStart
- Extended by:
- M3u8
- Includes:
- AttributeFormatter, Serializable
- Defined in:
- lib/m3u8/playback_start.rb
Overview
PlaybackStart represents a #EXT-X-START tag and attributes
Constant Summary
Constants included from M3u8
Instance Attribute Summary collapse
Class Method Summary collapse
-
.parse(text) ⇒ PlaybackStart
Parse an EXT-X-START tag.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PlaybackStart
constructor
A new instance of PlaybackStart.
-
#to_s ⇒ String
Render as an m3u8 EXT-X-START tag.
Methods included from M3u8
initialize_with_byterange, parse_attributes, parse_float, parse_int, parse_yes_no, to_yes_no
Methods included from AttributeFormatter
#boolean_format, #decimal_format, #quoted_format, #unquoted_format
Methods included from Serializable
#as_json, serialize, #to_h, #to_json
Constructor Details
#initialize(options = {}) ⇒ PlaybackStart
Returns a new instance of PlaybackStart.
15 16 17 18 19 |
# File 'lib/m3u8/playback_start.rb', line 15 def initialize( = {}) .each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#precise ⇒ Float, ...
12 13 14 |
# File 'lib/m3u8/playback_start.rb', line 12 def precise @precise end |
#time_offset ⇒ Float, ...
12 13 14 |
# File 'lib/m3u8/playback_start.rb', line 12 def time_offset @time_offset end |
Class Method Details
.parse(text) ⇒ PlaybackStart
Parse an EXT-X-START tag.
24 25 26 27 28 29 30 31 32 |
# File 'lib/m3u8/playback_start.rb', line 24 def self.parse(text) attributes = parse_attributes(text) precise = attributes['PRECISE'] = { time_offset: attributes['TIME-OFFSET'].to_f, precise: precise.nil? ? nil : parse_yes_no(precise) } PlaybackStart.new() end |
Instance Method Details
#to_s ⇒ String
Render as an m3u8 EXT-X-START tag.
36 37 38 39 40 |
# File 'lib/m3u8/playback_start.rb', line 36 def to_s attributes = ["TIME-OFFSET=#{time_offset}", boolean_format('PRECISE', precise)].compact.join(',') "#EXT-X-START:#{attributes}" end |