Class: M3u8::PreloadHintItem
- Inherits:
-
Object
- Object
- M3u8::PreloadHintItem
- Extended by:
- M3u8
- Includes:
- AttributeFormatter, Serializable
- Defined in:
- lib/m3u8/preload_hint_item.rb
Overview
PreloadHintItem represents an EXT-X-PRELOAD-HINT tag which allows a server to indicate a resource that will be needed soon.
Constant Summary
Constants included from M3u8
Instance Attribute Summary collapse
- #byterange_length ⇒ String, ...
- #byterange_start ⇒ String, ...
- #type ⇒ String, ...
- #uri ⇒ String, ...
Class Method Summary collapse
-
.parse(text) ⇒ PreloadHintItem
Parse an EXT-X-PRELOAD-HINT tag.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ PreloadHintItem
constructor
A new instance of PreloadHintItem.
-
#to_s ⇒ String
Render as an m3u8 EXT-X-PRELOAD-HINT 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 = {}) ⇒ PreloadHintItem
Returns a new instance of PreloadHintItem.
18 19 20 21 22 |
# File 'lib/m3u8/preload_hint_item.rb', line 18 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#byterange_length ⇒ String, ...
15 16 17 |
# File 'lib/m3u8/preload_hint_item.rb', line 15 def byterange_length @byterange_length end |
#byterange_start ⇒ String, ...
15 16 17 |
# File 'lib/m3u8/preload_hint_item.rb', line 15 def byterange_start @byterange_start end |
#type ⇒ String, ...
15 16 17 |
# File 'lib/m3u8/preload_hint_item.rb', line 15 def type @type end |
#uri ⇒ String, ...
15 16 17 |
# File 'lib/m3u8/preload_hint_item.rb', line 15 def uri @uri end |
Class Method Details
.parse(text) ⇒ PreloadHintItem
Parse an EXT-X-PRELOAD-HINT tag.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/m3u8/preload_hint_item.rb', line 27 def self.parse(text) attributes = parse_attributes(text) PreloadHintItem.new( type: attributes['TYPE'], uri: attributes['URI'], byterange_start: parse_int(attributes['BYTERANGE-START']), byterange_length: parse_int(attributes['BYTERANGE-LENGTH']) ) end |
Instance Method Details
#to_s ⇒ String
Render as an m3u8 EXT-X-PRELOAD-HINT tag.
41 42 43 |
# File 'lib/m3u8/preload_hint_item.rb', line 41 def to_s "#EXT-X-PRELOAD-HINT:#{formatted_attributes}" end |