Sha256: 5bd43ddf3ec608102355c1877dbab9e02b130ad1e1795fdd771f7c4bca2ca6db
Contents?: true
Size: 677 Bytes
Versions: 3
Compression:
Stored size: 677 Bytes
Contents
# frozen_string_literal: true module M3u8 # ByteRange represents sub range of a resource class ByteRange attr_accessor :length, :start def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end def self.parse(text) values = text.split('@') length_value = values[0].to_i start_value = values[1].to_i unless values[1].nil? options = { length: length_value, start: start_value } ByteRange.new(options) end def to_s "#{length}#{start_format}" end private def start_format return if start.nil? "@#{start}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
m3u8-0.8.2 | lib/m3u8/byte_range.rb |
m3u8-0.8.1 | lib/m3u8/byte_range.rb |
m3u8-0.8.0 | lib/m3u8/byte_range.rb |