Class: M3u8::SessionDataItem
- Inherits:
-
Object
- Object
- M3u8::SessionDataItem
- Extended by:
- M3u8
- 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
-
#data_id ⇒ Object
Returns the value of attribute data_id.
-
#language ⇒ Object
Returns the value of attribute language.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ SessionDataItem
constructor
A new instance of SessionDataItem.
- #to_s ⇒ Object
Methods included from M3u8
intialize_with_byterange, parse_attributes, parse_float, parse_yes_no, to_yes_no
Constructor Details
#initialize(params = {}) ⇒ SessionDataItem
Returns a new instance of SessionDataItem.
8 9 10 11 12 |
# File 'lib/m3u8/session_data_item.rb', line 8 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#data_id ⇒ Object
Returns the value of attribute data_id.
6 7 8 |
# File 'lib/m3u8/session_data_item.rb', line 6 def data_id @data_id end |
#language ⇒ Object
Returns the value of attribute language.
6 7 8 |
# File 'lib/m3u8/session_data_item.rb', line 6 def language @language end |
#uri ⇒ Object
Returns the value of attribute uri.
6 7 8 |
# File 'lib/m3u8/session_data_item.rb', line 6 def uri @uri end |
#value ⇒ Object
Returns the value of attribute value.
6 7 8 |
# File 'lib/m3u8/session_data_item.rb', line 6 def value @value end |
Class Method Details
.parse(text) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/m3u8/session_data_item.rb', line 14 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 ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/m3u8/session_data_item.rb', line 21 def to_s attributes = [data_id_format, value_format, uri_format, language_format].compact.join(',') "#EXT-X-SESSION-DATA:#{attributes}" end |