Sha256: 8aa5658b538a9017815e35eefd8a2f897519a2a9700f982ddd281509cc01c647

Contents?: true

Size: 584 Bytes

Versions: 2

Compression:

Stored size: 584 Bytes

Contents

class M3Uzi
  class Tag < Item

    attr_reader :name
    attr_accessor :value

    VALID_TAGS = %w{ALLOW-CACHE}

    # Unsupported tags: I-FRAMES-ONLY
    # Autogenerated tags: EXTM3U, VERSION, ENDLIST, BYTERANGE, TARGETDURATION, MEDIA-SEQUENCE, PLAYLIST-TYPE

    def name=(n)
      @name = n.to_s.upcase.gsub("_", "-")
    end

    def format
      string << "#EXT-X-#{name}"
      string << ":#{value}" if value
      string
    end

    def valid?
      case name
      when 'ALLOW-CACHE'
        ['YES','NO'].include?(value)
      else
        true
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
m3uzi-0.5.1 lib/m3uzi/tag.rb
m3uzi-0.5.0 lib/m3uzi/tag.rb