Class: Jsapi::Status::Range
Overview
Represents a range of status codes.
Constant Summary collapse
- INFORMATIONAL =
The range of informational status codes (1xx).
Range.new(1)
- SUCCESS =
The range of success status codes (2xx).
Range.new(2)
- REDIRECTION =
The range of redirection status codes (3xx).
Range.new(3)
- CLIENT_ERROR =
The range of client error status codes (4xx).
Range.new(4)
- SERVER_ERROR =
The range of server error status codes (5xx).
Range.new(5)
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(hundreds) ⇒ Range
constructor
:nodoc:.
-
#match?(status_code) ⇒ Boolean
Returns true if the range covers
status_code.
Methods inherited from Base
Constructor Details
#initialize(hundreds) ⇒ Range
:nodoc:
7 8 9 10 11 12 |
# File 'lib/jsapi/status/range.rb', line 7 def initialize(hundreds) # :nodoc: super("#{hundreds}XX", priority: 2) range_begin = hundreds * 100 @range = (range_begin..(range_begin + 99)) end |
Instance Method Details
#match?(status_code) ⇒ Boolean
Returns true if the range covers status_code.
30 31 32 |
# File 'lib/jsapi/status/range.rb', line 30 def match?(status_code) @range.cover?(status_code.value) if status_code end |