Sha256: 1805c155882d8cbf8e93aecf8d4488797728080cc0d0a93578d1cab66cebde10

Contents?: true

Size: 631 Bytes

Versions: 6

Compression:

Stored size: 631 Bytes

Contents

require 'bigdecimal'
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 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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
m3u8-0.6.9 lib/m3u8.rb
m3u8-0.6.8 lib/m3u8.rb
m3u8-0.6.7 lib/m3u8.rb
m3u8-0.6.6 lib/m3u8.rb
m3u8-0.6.5 lib/m3u8.rb
m3u8-0.6.4 lib/m3u8.rb