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.
6 7 8 |
# File 'lib/m3u8/writer.rb', line 6 def initialize(io) self.io = io end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
4 5 6 |
# File 'lib/m3u8/writer.rb', line 4 def io @io end |
Instance Method Details
#write(playlist) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/m3u8/writer.rb', line 10 def write(playlist) validate playlist io.puts '#EXTM3U' write_header(playlist) unless playlist.master? playlist.items.each do |item| io.puts item.to_s end return if playlist.master? io.puts '#EXT-X-ENDLIST' end |