class M3U8::ByteRange

Overview

ByteRange represents sub range of a resource

Included Modules

Extended Modules

Defined in:

m3u8/byte_range.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(string : String) #
ByteRange.new("4500@600")
ByteRange.new("4500")

[View source]
def self.new(params : NamedTuple = NamedTuple.new) #
options = {length: 4500, start: 600}
ByteRange.new(options)
ByteRange.new(length: 4500, start: 600)

[View source]
def self.new(length : Int32 | Nil = nil, start : Int32 | Nil = nil) #
ByteRange.new

[View source]

Class Method Detail

def self.parse(item = nil) #
ByteRange.parse(ByteRange.new(length: 4500, start: 600))
ByteRange.parse({length: 4500, start: 600})
ByteRange.parse("4500@600")
ByteRange.parse

[View source]

Instance Method Detail

def ==(other : String) #
left = ByteRange.new(length: 4500, start: 600)
right = "4500@600",
left == right # => true

[View source]
def ==(other : NamedTuple) #
left = ByteRange.new(length: 4500, start: 600)
right = { length: 4500, start: 600 },
left == right # => true

[View source]
def ==(other : ByteRange) #
left =  ByteRange.new(length: 4500, start: 600),
right =  ByteRange.new(length: 4500, start: 600)
left == right # => true

[View source]
def empty? #
byterange = ByteRange.new
byterange.empty? # => true
byterange = ByteRange.new(length: 0)
byterange.empty? # => true
byterange.length = 4500
byterange.empty? # => false

[View source]
def length : Int32 | Nil #

[View source]
def length=(length : Int32 | Nil) #

[View source]
def start : Int32 | Nil #

[View source]
def start=(start : Int32 | Nil) #

[View source]
def to_s #
byterange = ByteRange.new(length: 4500, start: 600)
byterange.to_s # => "4500@600"
byterange = ByteRange.new(length: 4500)
byterange.to_s # => "4500"
byterange = ByteRange.new
byterange.to_s # => ""

[View source]