class M3u8::SessionDataItem
SessionDataItem
represents a set of EXT-X-SESSION-DATA attributes
Attributes
data_id[RW]
language[RW]
uri[RW]
value[RW]
Public Class Methods
new(params = {})
click to toggle source
# File lib/m3u8/session_data_item.rb, line 8 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end
parse(text)
click to toggle source
# File lib/m3u8/session_data_item.rb, line 14 def self.parse(text) attributes = parse_attributes text options = { data_id: attributes['DATA-ID'], value: attributes['VALUE'], uri: attributes['URI'], language: attributes['LANGUAGE'] } M3u8::SessionDataItem.new options end
Public Instance Methods
to_s()
click to toggle source
# 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
Private Instance Methods
data_id_format()
click to toggle source
# File lib/m3u8/session_data_item.rb, line 31 def data_id_format %(DATA-ID="#{data_id}") end
language_format()
click to toggle source
# File lib/m3u8/session_data_item.rb, line 47 def language_format return if language.nil? %(LANGUAGE="#{language}") end
uri_format()
click to toggle source
# File lib/m3u8/session_data_item.rb, line 41 def uri_format return if uri.nil? %(URI="#{uri}") end
value_format()
click to toggle source
# File lib/m3u8/session_data_item.rb, line 35 def value_format return if value.nil? %(VALUE="#{value}") end