Class: M3u8::Writer
- Inherits:
-
Object
- Object
- M3u8::Writer
- Defined in:
- lib/m3u8/writer.rb
Overview
Writer provides generation of text output of playlists in m3u8 format
Instance Attribute Summary collapse
-
#io ⇒ Object
Returns the value of attribute io.
Instance Method Summary collapse
-
#initialize(io) ⇒ Writer
constructor
A new instance of Writer.
- #write(playlist) ⇒ Object
Constructor Details
#initialize(io) ⇒ Writer
Returns a new instance of Writer.
7 8 9 |
# File 'lib/m3u8/writer.rb', line 7 def initialize(io) self.io = io end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
5 6 7 |
# File 'lib/m3u8/writer.rb', line 5 def io @io end |
Instance Method Details
#write(playlist) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/m3u8/writer.rb', line 11 def write(playlist) validate(playlist) write_header(playlist) playlist.items.each do |item| io.puts item.to_s end return if playlist.master? io.puts '#EXT-X-ENDLIST' end |