lib/m3u8.rb in m3u8-0.7.0 vs lib/m3u8.rb in m3u8-0.7.1
- old
+ new
@@ -1,5 +1,6 @@
+# frozen_string_literal: true
require 'bigdecimal'
require 'stringio'
Dir[File.dirname(__FILE__) + '/m3u8/*.rb'].sort.each { |file| require file }
# M3u8 provides parsing, generation, and validation of m3u8 playlists
@@ -10,11 +11,15 @@
instance_variable_set("@#{key}", value)
end
end
def parse_attributes(line)
- array = line.delete("\n").scan(/([A-z-]+)\s*=\s*("[^"]*"|[^,]*)/)
+ array = line.delete("\n").scan(/([A-z0-9-]+)\s*=\s*("[^"]*"|[^,]*)/)
Hash[array.map { |key, value| [key, value.delete('"')] }]
+ end
+
+ def parse_float(value)
+ value.nil? ? nil : value.to_f
end
def parse_yes_no(value)
value == 'YES' ? true : false
end