Class: M3u8::SegmentItem

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

Overview

SegmentItem represents EXTINF attributes with the URI that follows, optionally allowing an EXT-X-BYTERANGE tag to be set.

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_yes_no

Constructor Details

#initialize(params = {}) ⇒ SegmentItem

Returns a new instance of SegmentItem.



8
9
10
# File 'lib/m3u8/segment_item.rb', line 8

def initialize(params = {})
  intialize_with_byterange(params)
end

Instance Attribute Details

#byterangeObject

Returns the value of attribute byterange.



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

def byterange
  @byterange
end

#commentObject

Returns the value of attribute comment.



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

def comment
  @comment
end

#durationObject

Returns the value of attribute duration.



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

def duration
  @duration
end

#program_date_timeObject

Returns the value of attribute program_date_time.



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

def program_date_time
  @program_date_time
end

#segmentObject

Returns the value of attribute segment.



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

def segment
  @segment
end

Instance Method Details

#to_sObject



12
13
14
15
# File 'lib/m3u8/segment_item.rb', line 12

def to_s
  date = "#{program_date_time}\n" unless program_date_time.nil?
  "#EXTINF:#{duration},#{comment}#{byterange_format}\n#{date}#{segment}"
end