lib/m3u8.rb in m3u8-0.6.9 vs lib/m3u8.rb in m3u8-0.7.0
- old
+ new
@@ -2,21 +2,25 @@
require 'stringio'
Dir[File.dirname(__FILE__) + '/m3u8/*.rb'].sort.each { |file| require file }
# M3u8 provides parsing, generation, and validation of m3u8 playlists
module M3u8
+ def intialize_with_byterange(params = {})
+ params.each do |key, value|
+ value = ByteRange.new(value) if value.is_a?(Hash)
+ instance_variable_set("@#{key}", value)
+ end
+ end
+
def parse_attributes(line)
array = line.delete("\n").scan(/([A-z-]+)\s*=\s*("[^"]*"|[^,]*)/)
Hash[array.map { |key, value| [key, value.delete('"')] }]
end
def parse_yes_no(value)
value == 'YES' ? true : false
end
- def intialize_with_byterange(params = {})
- params.each do |key, value|
- value = ByteRange.new(value) if value.is_a?(Hash)
- instance_variable_set("@#{key}", value)
- end
+ def to_yes_no(boolean)
+ boolean == true ? 'YES' : 'NO'
end
end