Class: M3u8::PartItem
- Inherits:
-
Object
- Object
- M3u8::PartItem
- Extended by:
- M3u8
- Includes:
- M3u8, AttributeFormatter, Serializable
- Defined in:
- lib/m3u8/part_item.rb
Overview
PartItem represents an EXT-X-PART tag for Low-Latency HLS partial segments.
Constant Summary
Constants included from M3u8
Instance Attribute Summary collapse
- #byterange ⇒ String, ...
- #duration ⇒ String, ...
- #gap ⇒ String, ...
- #independent ⇒ String, ...
- #uri ⇒ String, ...
Class Method Summary collapse
-
.parse(text) ⇒ PartItem
Parse an EXT-X-PART tag.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ PartItem
constructor
A new instance of PartItem.
-
#to_s ⇒ String
Render as an m3u8 EXT-X-PART 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(params = {}) ⇒ PartItem
Returns a new instance of PartItem.
20 21 22 |
# File 'lib/m3u8/part_item.rb', line 20 def initialize(params = {}) initialize_with_byterange(params) end |
Instance Attribute Details
#byterange ⇒ String, ...
17 18 19 |
# File 'lib/m3u8/part_item.rb', line 17 def byterange @byterange end |
#duration ⇒ String, ...
17 18 19 |
# File 'lib/m3u8/part_item.rb', line 17 def duration @duration end |
#gap ⇒ String, ...
17 18 19 |
# File 'lib/m3u8/part_item.rb', line 17 def gap @gap end |
#independent ⇒ String, ...
17 18 19 |
# File 'lib/m3u8/part_item.rb', line 17 def independent @independent end |
#uri ⇒ String, ...
17 18 19 |
# File 'lib/m3u8/part_item.rb', line 17 def uri @uri end |
Class Method Details
.parse(text) ⇒ PartItem
Parse an EXT-X-PART tag.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/m3u8/part_item.rb', line 27 def self.parse(text) attributes = parse_attributes(text) range_value = attributes['BYTERANGE'] range = ByteRange.parse(range_value) unless range_value.nil? PartItem.new( uri: attributes['URI'], duration: attributes['DURATION'].to_f, independent: parse_yes_no(attributes['INDEPENDENT']), byterange: range, gap: parse_yes_no(attributes['GAP']) ) end |
Instance Method Details
#to_s ⇒ String
Render as an m3u8 EXT-X-PART tag.
42 43 44 |
# File 'lib/m3u8/part_item.rb', line 42 def to_s "#EXT-X-PART:#{formatted_attributes}" end |