Class: Low::Types::Status::StatusCode
Constant Summary collapse
- STATUS_CODES =
[ # Info. 100, 101, 102, 103, # Success. 200, 201, 202, 203, 204, 205, 206, 207, 208, 226, # Redirect. 300, 301, 302, 303, 304, 305, 306, 307, 308, # Client Error. 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 421, 422, 423, 424, 425, 426, 428, 429, 431, 451, # Server Error. 500, 501, 502, 503, 504, 505, 506, 507, 508, 510, 511 ].freeze
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(status_code) ⇒ StatusCode
constructor
A new instance of StatusCode.
Constructor Details
#initialize(status_code) ⇒ StatusCode
Returns a new instance of StatusCode.
34 35 36 37 38 |
# File 'lib/types/status.rb', line 34 def initialize(status_code) raise AllowedTypeError unless STATUS_CODES.include?(status_code) @status_code = status_code end |
Instance Attribute Details
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
18 19 20 |
# File 'lib/types/status.rb', line 18 def status_code @status_code end |
Instance Method Details
#==(other) ⇒ Object
40 41 42 |
# File 'lib/types/status.rb', line 40 def ==(other) other.class == self.class && other.status_code == @status_code end |
#eql?(other) ⇒ Boolean
44 45 46 |
# File 'lib/types/status.rb', line 44 def eql?(other) self == other end |
#hash ⇒ Object
48 49 50 |
# File 'lib/types/status.rb', line 48 def hash [self.class, @status_code].hash end |