Sha256: 99f36c83d2987c2cdbe29d97cc44ab73ab65a3283577add57c3849c9a42ea235

Contents?: true

Size: 539 Bytes

Versions: 7

Compression:

Stored size: 539 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, :byterange

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

    def to_s
      "#EXTINF:#{duration},#{comment}#{byterange_format}\n#{segment}"
    end

    private

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
m3u8-0.6.7 lib/m3u8/segment_item.rb
m3u8-0.6.6 lib/m3u8/segment_item.rb
m3u8-0.6.5 lib/m3u8/segment_item.rb
m3u8-0.6.4 lib/m3u8/segment_item.rb
m3u8-0.6.3 lib/m3u8/segment_item.rb
m3u8-0.6.2 lib/m3u8/segment_item.rb
m3u8-0.6.1 lib/m3u8/segment_item.rb