Class: M3u8::DateRangeItem
- Inherits:
-
Object
- Object
- M3u8::DateRangeItem
- Includes:
- M3u8
- Defined in:
- lib/m3u8/date_range_item.rb
Overview
DateRangeItem represents a #EXT-X-DATERANGE tag
Constant Summary
Constants included from M3u8
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#client_attributes ⇒ Object
Returns the value of attribute client_attributes.
-
#duration ⇒ Object
Returns the value of attribute duration.
-
#end_date ⇒ Object
Returns the value of attribute end_date.
-
#end_on_next ⇒ Object
Returns the value of attribute end_on_next.
-
#id ⇒ Object
Returns the value of attribute id.
-
#planned_duration ⇒ Object
Returns the value of attribute planned_duration.
-
#scte35_cmd ⇒ Object
Returns the value of attribute scte35_cmd.
-
#scte35_in ⇒ Object
Returns the value of attribute scte35_in.
-
#scte35_out ⇒ Object
Returns the value of attribute scte35_out.
-
#start_date ⇒ Object
Returns the value of attribute start_date.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ DateRangeItem
constructor
A new instance of DateRangeItem.
- #parse(text) ⇒ Object
- #to_s ⇒ Object
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( = {}) .each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#class_name ⇒ Object
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_attributes ⇒ Object
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 |
#duration ⇒ Object
Returns the value of attribute duration.
6 7 8 |
# File 'lib/m3u8/date_range_item.rb', line 6 def duration @duration end |
#end_date ⇒ Object
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_next ⇒ Object
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 |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/m3u8/date_range_item.rb', line 6 def id @id end |
#planned_duration ⇒ Object
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_cmd ⇒ Object
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_in ⇒ Object
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_out ⇒ Object
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_date ⇒ Object
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_s ⇒ Object
31 32 33 |
# File 'lib/m3u8/date_range_item.rb', line 31 def to_s "#EXT-X-DATERANGE:#{formatted_attributes}" end |