Sha256: 73e05b135a73414a4e14f5a7c080d99c9a30ff55f0e879273b7a4a25c514560e
Contents?: true
Size: 675 Bytes
Versions: 1
Compression:
Stored size: 675 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
m3u8-0.7.1 | lib/m3u8/byte_range.rb |