class M3Uzi class Tag < Item attr_reader :name attr_accessor :value VALID_TAGS = %w{PLAYLIST-TYPE ALLOW-CACHE} # Unsupported tags: MEDIA-SEQUENCE, I-FRAMES-ONLY, PLAYLIST-TYPE # Autogenerated tags: EXTM3U, VERSION, ENDLIST, BYTERANGE, TARGETDURATION 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 'PLAYLIST-TYPE' ['EVENT','VOD'].include?(value) when 'ALLOW-CACHE' ['YES','NO'].include?(value) else true end end end end