Sha256: 4caa66fe11e6d3e5bd98fa91e4768d921bfbe9ed9557eb764aa4c2aaec46a00c

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

module M3u8
  # SegmentItem represents EXTINF attributes with the URI that follows,
  # optionally allowing an EXT-X-BYTERANGE tag to be set.
  class SegmentItem
    include M3u8
    attr_accessor :duration, :segment, :comment, :program_date_time, :byterange

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

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

    private

    def byterange_format
      return if byterange.nil?
      "\n#EXT-X-BYTERANGE:#{byterange}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
m3u8-0.7.0 lib/m3u8/segment_item.rb
m3u8-0.6.9 lib/m3u8/segment_item.rb
m3u8-0.6.8 lib/m3u8/segment_item.rb