Class: M3u8::MapItem

Inherits:
Object
  • Object
show all
Extended by:
M3u8
Includes:
M3u8
Defined in:
lib/m3u8/map_item.rb

Overview

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

Constant Summary

Constants included from M3u8

VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from M3u8

intialize_with_byterange, parse_attributes, parse_yes_no

Constructor Details

#initialize(params = {}) ⇒ MapItem

Returns a new instance of MapItem.



9
10
11
# File 'lib/m3u8/map_item.rb', line 9

def initialize(params = {})
  intialize_with_byterange(params)
end

Instance Attribute Details

#byterangeObject

Returns the value of attribute byterange.



7
8
9
# File 'lib/m3u8/map_item.rb', line 7

def byterange
  @byterange
end

#uriObject

Returns the value of attribute uri.



7
8
9
# File 'lib/m3u8/map_item.rb', line 7

def uri
  @uri
end

Class Method Details

.parse(text) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/m3u8/map_item.rb', line 13

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

Instance Method Details

#to_sObject



21
22
23
# File 'lib/m3u8/map_item.rb', line 21

def to_s
  %(#EXT-X-MAP:URI="#{uri}"#{byterange_format})
end