Class: HTTPRange
- Inherits:
-
Object
- Object
- HTTPRange
- 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
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#first ⇒ Object
readonly
Returns the value of attribute first.
-
#first_inclusive ⇒ Object
readonly
Returns the value of attribute first_inclusive.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
-
#last_inclusive ⇒ Object
readonly
Returns the value of attribute last_inclusive.
-
#max ⇒ Object
readonly
Returns the value of attribute max.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(fields) ⇒ HTTPRange
constructor
A new instance of HTTPRange.
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
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
7 8 9 |
# File 'lib/http_range.rb', line 7 def attribute @attribute end |
#first ⇒ Object (readonly)
Returns the value of attribute first.
8 9 10 |
# File 'lib/http_range.rb', line 8 def first @first end |
#first_inclusive ⇒ Object (readonly)
Returns the value of attribute first_inclusive.
10 11 12 |
# File 'lib/http_range.rb', line 10 def first_inclusive @first_inclusive end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
9 10 11 |
# File 'lib/http_range.rb', line 9 def last @last end |
#last_inclusive ⇒ Object (readonly)
Returns the value of attribute last_inclusive.
11 12 13 |
# File 'lib/http_range.rb', line 11 def last_inclusive @last_inclusive end |
#max ⇒ Object (readonly)
Returns the value of attribute max.
13 14 15 |
# File 'lib/http_range.rb', line 13 def max @max end |
#order ⇒ Object (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 |