Class: M3Uzi::Tag

Inherits:
Item
  • Object
show all
Defined in:
lib/m3uzi/tag.rb

Constant Summary collapse

VALID_TAGS =
%w{ALLOW-CACHE}

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/m3uzi/tag.rb', line 4

def name
  @name
end

#valueObject

Returns the value of attribute value.



5
6
7
# File 'lib/m3uzi/tag.rb', line 5

def value
  @value
end

Instance Method Details

#formatObject



16
17
18
19
20
# File 'lib/m3uzi/tag.rb', line 16

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

#valid?Boolean

Returns:

  • (Boolean)


22
23
24
25
26
27
28
29
# File 'lib/m3uzi/tag.rb', line 22

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