Class: M3u8::ServerControlItem
- Inherits:
-
Object
- Object
- M3u8::ServerControlItem
- Extended by:
- M3u8
- Includes:
- AttributeFormatter, Serializable
- Defined in:
- lib/m3u8/server_control_item.rb
Overview
ServerControlItem represents an EXT-X-SERVER-CONTROL tag which provides directives for Low-Latency HLS delivery.
Constant Summary
Constants included from M3u8
Instance Attribute Summary collapse
- #can_block_reload ⇒ Float, ...
- #can_skip_dateranges ⇒ Float, ...
- #can_skip_until ⇒ Float, ...
- #hold_back ⇒ Float, ...
- #part_hold_back ⇒ Float, ...
Class Method Summary collapse
-
.parse(text) ⇒ ServerControlItem
Parse an EXT-X-SERVER-CONTROL tag.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ ServerControlItem
constructor
A new instance of ServerControlItem.
-
#to_s ⇒ String
Render as an m3u8 EXT-X-SERVER-CONTROL 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 = {}) ⇒ ServerControlItem
Returns a new instance of ServerControlItem.
20 21 22 23 24 |
# File 'lib/m3u8/server_control_item.rb', line 20 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#can_block_reload ⇒ Float, ...
16 17 18 |
# File 'lib/m3u8/server_control_item.rb', line 16 def can_block_reload @can_block_reload end |
#can_skip_dateranges ⇒ Float, ...
16 17 18 |
# File 'lib/m3u8/server_control_item.rb', line 16 def can_skip_dateranges @can_skip_dateranges end |
#can_skip_until ⇒ Float, ...
16 17 18 |
# File 'lib/m3u8/server_control_item.rb', line 16 def can_skip_until @can_skip_until end |
#hold_back ⇒ Float, ...
16 17 18 |
# File 'lib/m3u8/server_control_item.rb', line 16 def hold_back @hold_back end |
#part_hold_back ⇒ Float, ...
16 17 18 |
# File 'lib/m3u8/server_control_item.rb', line 16 def part_hold_back @part_hold_back end |
Class Method Details
.parse(text) ⇒ ServerControlItem
Parse an EXT-X-SERVER-CONTROL tag.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/m3u8/server_control_item.rb', line 29 def self.parse(text) attributes = parse_attributes(text) ServerControlItem.new( can_skip_until: parse_float(attributes['CAN-SKIP-UNTIL']), can_skip_dateranges: parse_yes_no(attributes['CAN-SKIP-DATERANGES']), hold_back: parse_float(attributes['HOLD-BACK']), part_hold_back: parse_float(attributes['PART-HOLD-BACK']), can_block_reload: parse_yes_no(attributes['CAN-BLOCK-RELOAD']) ) end |
Instance Method Details
#to_s ⇒ String
Render as an m3u8 EXT-X-SERVER-CONTROL tag.
44 45 46 |
# File 'lib/m3u8/server_control_item.rb', line 44 def to_s "#EXT-X-SERVER-CONTROL:#{formatted_attributes}" end |