Class: M3u8::Playlist

Inherits:
Object
  • Object
show all
Defined in:
lib/m3u8/playlist.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Playlist

Returns a new instance of Playlist.



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

def initialize(options = {})
  assign_options options
  self.items = []
end

Instance Attribute Details

#cacheObject

Returns the value of attribute cache.



3
4
5
# File 'lib/m3u8/playlist.rb', line 3

def cache
  @cache
end

#itemsObject

Returns the value of attribute items.



3
4
5
# File 'lib/m3u8/playlist.rb', line 3

def items
  @items
end

#sequenceObject

Returns the value of attribute sequence.



3
4
5
# File 'lib/m3u8/playlist.rb', line 3

def sequence
  @sequence
end

#targetObject

Returns the value of attribute target.



3
4
5
# File 'lib/m3u8/playlist.rb', line 3

def target
  @target
end

#versionObject

Returns the value of attribute version.



3
4
5
# File 'lib/m3u8/playlist.rb', line 3

def version
  @version
end

Class Method Details

.codecs(options = {}) ⇒ Object



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

def self.codecs(options = {})
  item = PlaylistItem.new options
  item.codecs
end

.read(input) ⇒ Object



15
16
17
18
# File 'lib/m3u8/playlist.rb', line 15

def self.read(input)
  reader = Reader.new
  reader.read input
end

Instance Method Details

#master?Boolean

Returns:

  • (Boolean)


25
26
27
28
# File 'lib/m3u8/playlist.rb', line 25

def master?
  return false if playlist_size == 0 && segment_size == 0
  playlist_size > 0
end

#to_sObject



30
31
32
33
34
# File 'lib/m3u8/playlist.rb', line 30

def to_s
  output = StringIO.open
  write output
  output.string
end

#valid?Boolean

Returns:

  • (Boolean)


36
37
38
39
# File 'lib/m3u8/playlist.rb', line 36

def valid?
  return false if playlist_size > 0 && segment_size > 0
  true
end

#write(output) ⇒ Object



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

def write(output)
  writer = Writer.new output
  writer.write self
end