Class: M3u8::Reader

Inherits:
Object
  • Object
show all
Includes:
M3u8
Defined in:
lib/m3u8/reader.rb

Overview

Reader provides parsing of m3u8 playlists

Constant Summary

Constants included from M3u8

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from M3u8

#intialize_with_byterange, #parse_attributes, #parse_yes_no

Constructor Details

#initializeReader

Returns a new instance of Reader.



7
8
9
10
11
12
# File 'lib/m3u8/reader.rb', line 7

def initialize(*)
  @tags = [basic_tags,
           media_segment_tags,
           media_playlist_tags,
           master_playlist_tags].inject(:merge)
end

Instance Attribute Details

#itemObject

Returns the value of attribute item.



5
6
7
# File 'lib/m3u8/reader.rb', line 5

def item
  @item
end

#masterObject

Returns the value of attribute master.



5
6
7
# File 'lib/m3u8/reader.rb', line 5

def master
  @master
end

#openObject

Returns the value of attribute open.



5
6
7
# File 'lib/m3u8/reader.rb', line 5

def open
  @open
end

#playlistObject

Returns the value of attribute playlist.



5
6
7
# File 'lib/m3u8/reader.rb', line 5

def playlist
  @playlist
end

#tagsObject

Returns the value of attribute tags.



5
6
7
# File 'lib/m3u8/reader.rb', line 5

def tags
  @tags
end

Instance Method Details

#read(input) ⇒ Object



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

def read(input)
  self.playlist = Playlist.new
  input.each_line do |line|
    parse_line line
  end
  playlist
end