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_float, parse_yes_no, to_yes_no

Constructor Details

#initialize(params = {}) ⇒ MapItem

Returns a new instance of MapItem.



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

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

Instance Attribute Details

#byterangeObject

Returns the value of attribute byterange.



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

def byterange
  @byterange
end

#uriObject

Returns the value of attribute uri.



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

def uri
  @uri
end

Class Method Details

.parse(text) ⇒ Object



14
15
16
17
18
19
20
# 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

Instance Method Details

#to_sObject



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

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