Class: M3u8::Writer
- Inherits:
-
Object
- Object
- M3u8::Writer
- Defined in:
- lib/m3u8/writer.rb
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.
5 6 7 |
# File 'lib/m3u8/writer.rb', line 5 def initialize(io) self.io = io end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
3 4 5 |
# File 'lib/m3u8/writer.rb', line 3 def io @io end |
Instance Method Details
#write(playlist) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/m3u8/writer.rb', line 9 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 |