Class: M3u8::ContentSteeringItem

Inherits:
Object
  • Object
show all
Extended by:
M3u8
Includes:
AttributeFormatter, Serializable
Defined in:
lib/m3u8/content_steering_item.rb

Overview

ContentSteeringItem represents an EXT-X-CONTENT-STEERING tag which indicates a Content Steering Manifest for dynamic pathway selection.

Constant Summary

Constants included from M3u8

VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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 = {}) ⇒ ContentSteeringItem

Returns a new instance of ContentSteeringItem.

Parameters:

  • params (Hash) (defaults to: {})

    attribute key-value pairs



16
17
18
19
20
# File 'lib/m3u8/content_steering_item.rb', line 16

def initialize(params = {})
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#pathway_idString?

Returns:

  • (String, nil)

    steering manifest server URI

  • (String, nil)

    default pathway ID



13
14
15
# File 'lib/m3u8/content_steering_item.rb', line 13

def pathway_id
  @pathway_id
end

#server_uriString?

Returns:

  • (String, nil)

    steering manifest server URI

  • (String, nil)

    default pathway ID



13
14
15
# File 'lib/m3u8/content_steering_item.rb', line 13

def server_uri
  @server_uri
end

Class Method Details

.parse(text) ⇒ ContentSteeringItem

Parse an EXT-X-CONTENT-STEERING tag.

Parameters:

  • text (String)

    raw tag line

Returns:



25
26
27
28
29
30
31
# File 'lib/m3u8/content_steering_item.rb', line 25

def self.parse(text)
  attributes = parse_attributes(text)
  ContentSteeringItem.new(
    server_uri: attributes['SERVER-URI'],
    pathway_id: attributes['PATHWAY-ID']
  )
end

Instance Method Details

#to_sString

Render as an m3u8 EXT-X-CONTENT-STEERING tag.

Returns:

  • (String)


35
36
37
# File 'lib/m3u8/content_steering_item.rb', line 35

def to_s
  "#EXT-X-CONTENT-STEERING:#{formatted_attributes}"
end