class M3u8::ByteRange
ByteRange
represents sub range of a resource
Attributes
length[RW]
start[RW]
Public Class Methods
new(params = {})
click to toggle source
# File lib/m3u8/byte_range.rb, line 7 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end
parse(text)
click to toggle source
# File lib/m3u8/byte_range.rb, line 13 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
Public Instance Methods
to_s()
click to toggle source
# File lib/m3u8/byte_range.rb, line 21 def to_s "#{length}#{start_format}" end
Private Instance Methods
start_format()
click to toggle source
# File lib/m3u8/byte_range.rb, line 27 def start_format return if start.nil? "@#{start}" end