Class: M3u8::SessionDataItem
- Inherits:
-
Object
- Object
- M3u8::SessionDataItem
- Extended by:
- M3u8
- Includes:
- AttributeFormatter, Serializable
- Defined in:
- lib/m3u8/session_data_item.rb
Overview
SessionDataItem represents a set of EXT-X-SESSION-DATA attributes
Constant Summary
Constants included from M3u8
Instance Attribute Summary collapse
Class Method Summary collapse
-
.parse(text) ⇒ SessionDataItem
Parse an EXT-X-SESSION-DATA tag.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ SessionDataItem
constructor
A new instance of SessionDataItem.
-
#to_s ⇒ String
Render as an m3u8 EXT-X-SESSION-DATA 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 = {}) ⇒ SessionDataItem
Returns a new instance of SessionDataItem.
17 18 19 20 21 |
# File 'lib/m3u8/session_data_item.rb', line 17 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#data_id ⇒ String?
14 15 16 |
# File 'lib/m3u8/session_data_item.rb', line 14 def data_id @data_id end |
#language ⇒ String?
14 15 16 |
# File 'lib/m3u8/session_data_item.rb', line 14 def language @language end |
#uri ⇒ String?
14 15 16 |
# File 'lib/m3u8/session_data_item.rb', line 14 def uri @uri end |
#value ⇒ String?
14 15 16 |
# File 'lib/m3u8/session_data_item.rb', line 14 def value @value end |
Class Method Details
.parse(text) ⇒ SessionDataItem
Parse an EXT-X-SESSION-DATA tag.
26 27 28 29 30 31 |
# File 'lib/m3u8/session_data_item.rb', line 26 def self.parse(text) attributes = parse_attributes text = { data_id: attributes['DATA-ID'], value: attributes['VALUE'], uri: attributes['URI'], language: attributes['LANGUAGE'] } M3u8::SessionDataItem.new end |
Instance Method Details
#to_s ⇒ String
Render as an m3u8 EXT-X-SESSION-DATA tag.
35 36 37 38 39 40 41 |
# File 'lib/m3u8/session_data_item.rb', line 35 def to_s attributes = [quoted_format('DATA-ID', data_id), quoted_format('VALUE', value), quoted_format('URI', uri), quoted_format('LANGUAGE', language)].compact.join(',') "#EXT-X-SESSION-DATA:#{attributes}" end |