module M3u8

M3u8 provides parsing, generation, and validation of m3u8 playlists

M3u8 provides parsing, generation, and validation of m3u8 playlists

Constants

VERSION

Public Instance Methods

intialize_with_byterange(params = {}) click to toggle source
# File lib/m3u8.rb, line 8
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
parse_attributes(line) click to toggle source
# File lib/m3u8.rb, line 15
def parse_attributes(line)
  array = line.delete("\n").scan(/([A-z0-9-]+)\s*=\s*("[^"]*"|[^,]*)/)
  Hash[array.map { |key, value| [key, value.delete('"')] }]
end
parse_float(value) click to toggle source
# File lib/m3u8.rb, line 20
def parse_float(value)
  value.nil? ? nil : value.to_f
end
parse_yes_no(value) click to toggle source
# File lib/m3u8.rb, line 24
def parse_yes_no(value)
  value == 'YES' ? true : false
end
to_yes_no(boolean) click to toggle source
# File lib/m3u8.rb, line 28
def to_yes_no(boolean)
  boolean == true ? 'YES' : 'NO'
end