Class: HTTPRange

Inherits:
Object
  • Object
show all
Defined in:
lib/http_range.rb,
lib/http_range/parser.rb,
lib/http_range/version.rb,
lib/http_range/middleware/accept_ranges.rb

Defined Under Namespace

Modules: Middleware Classes: MalformedRangeHeaderError, Parser

Constant Summary collapse

VERSION =
'1.2.0'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ HTTPRange

Returns a new instance of HTTPRange.



15
16
17
# File 'lib/http_range.rb', line 15

def initialize(fields)
  fields.each { |field, value| instance_variable_set(:"@#{field}", value) }
end

Instance Attribute Details

#attributeObject (readonly)

Returns the value of attribute attribute.



7
8
9
# File 'lib/http_range.rb', line 7

def attribute
  @attribute
end

#firstObject (readonly)

Returns the value of attribute first.



8
9
10
# File 'lib/http_range.rb', line 8

def first
  @first
end

#first_inclusiveObject (readonly)

Returns the value of attribute first_inclusive.



10
11
12
# File 'lib/http_range.rb', line 10

def first_inclusive
  @first_inclusive
end

#lastObject (readonly)

Returns the value of attribute last.



9
10
11
# File 'lib/http_range.rb', line 9

def last
  @last
end

#last_inclusiveObject (readonly)

Returns the value of attribute last_inclusive.



11
12
13
# File 'lib/http_range.rb', line 11

def last_inclusive
  @last_inclusive
end

#maxObject (readonly)

Returns the value of attribute max.



13
14
15
# File 'lib/http_range.rb', line 13

def max
  @max
end

#orderObject (readonly)

Returns the value of attribute order.



12
13
14
# File 'lib/http_range.rb', line 12

def order
  @order
end

Class Method Details

.parse(header_string) ⇒ Object



19
20
21
# File 'lib/http_range.rb', line 19

def self.parse(header_string)
  new(Parser.new(header_string).extract_parts_hash)
end