class M3u8::MapItem

MapItem represents a EXT-X-MAP tag which specifies how to obtain the Media Initialization Section

Attributes

byterange[RW]
uri[RW]

Public Class Methods

new(params = {}) click to toggle source
# File lib/m3u8/map_item.rb, line 10
def initialize(params = {})
  intialize_with_byterange(params)
end
parse(text) click to toggle source
# File lib/m3u8/map_item.rb, line 14
def self.parse(text)
  attributes = parse_attributes(text)
  range_value = attributes['BYTERANGE']
  range = ByteRange.parse(range_value) unless range_value.nil?
  options = { uri: attributes['URI'], byterange: range }
  MapItem.new(options)
end

Public Instance Methods

to_s() click to toggle source
# File lib/m3u8/map_item.rb, line 22
def to_s
  %(#EXT-X-MAP:URI="#{uri}"#{byterange_format})
end

Private Instance Methods

byterange_format() click to toggle source
# File lib/m3u8/map_item.rb, line 28
def byterange_format
  return if byterange.nil?
  %(,BYTERANGE="#{byterange}")
end