Class: M3u8::DateRangeItem

Inherits:
Object
  • Object
show all
Includes:
M3u8
Defined in:
lib/m3u8/date_range_item.rb

Overview

DateRangeItem represents a #EXT-X-DATERANGE tag

Constant Summary

Constants included from M3u8

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from M3u8

#intialize_with_byterange, #parse_attributes, #parse_float, #parse_yes_no, #to_yes_no

Constructor Details

#initialize(options = {}) ⇒ DateRangeItem

Returns a new instance of DateRangeItem.



10
11
12
13
14
# File 'lib/m3u8/date_range_item.rb', line 10

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
end

Instance Attribute Details

#class_nameObject

Returns the value of attribute class_name.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def class_name
  @class_name
end

#client_attributesObject

Returns the value of attribute client_attributes.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def client_attributes
  @client_attributes
end

#durationObject

Returns the value of attribute duration.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def duration
  @duration
end

#end_dateObject

Returns the value of attribute end_date.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def end_date
  @end_date
end

#end_on_nextObject

Returns the value of attribute end_on_next.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def end_on_next
  @end_on_next
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def id
  @id
end

#planned_durationObject

Returns the value of attribute planned_duration.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def planned_duration
  @planned_duration
end

#scte35_cmdObject

Returns the value of attribute scte35_cmd.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def scte35_cmd
  @scte35_cmd
end

#scte35_inObject

Returns the value of attribute scte35_in.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def scte35_in
  @scte35_in
end

#scte35_outObject

Returns the value of attribute scte35_out.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def scte35_out
  @scte35_out
end

#start_dateObject

Returns the value of attribute start_date.



6
7
8
# File 'lib/m3u8/date_range_item.rb', line 6

def start_date
  @start_date
end

Instance Method Details

#parse(text) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/m3u8/date_range_item.rb', line 16

def parse(text)
  attributes = parse_attributes(text)
  @id = attributes['ID']
  @class_name = attributes['CLASS']
  @start_date = attributes['START-DATE']
  @end_date = attributes['END-DATE']
  @duration = parse_float(attributes['DURATION'])
  @planned_duration = parse_float(attributes['PLANNED-DURATION'])
  @scte35_cmd = attributes['SCTE35-CMD']
  @scte35_out = attributes['SCTE35-OUT']
  @scte35_in = attributes['SCTE35-IN']
  @end_on_next = attributes.key?('END-ON-NEXT') ? true : false
  @client_attributes = parse_client_attributes(attributes)
end

#to_sObject



31
32
33
# File 'lib/m3u8/date_range_item.rb', line 31

def to_s
  "#EXT-X-DATERANGE:#{formatted_attributes}"
end