Lines Matching refs:code
28 attr_reader :code, :reason_phrase # :nodoc:
31 # Returns the HTTP status code
32 def code() self::class::code end
37 alias to_i code # :nodoc:
109 # Maps a status code to the corresponding Status class
112 # Creates a status or error class for each status code and
114 StatusMessage.each{|code, message|
119 case code
127 const_set("RC_#{var_name}", code)
129 err_class.instance_variable_set(:@code, code)
132 CodeToError[code] = err_class
136 # Returns the description corresponding to the HTTP status +code+
140 def reason_phrase(code)
141 StatusMessage[code.to_i]
145 # Is +code+ an informational status?
146 def info?(code)
147 code.to_i >= 100 and code.to_i < 200
151 # Is +code+ a successful status?
152 def success?(code)
153 code.to_i >= 200 and code.to_i < 300
157 # Is +code+ a redirection status?
158 def redirect?(code)
159 code.to_i >= 300 and code.to_i < 400
163 # Is +code+ an error status?
164 def error?(code)
165 code.to_i >= 400 and code.to_i < 600
169 # Is +code+ a client error status?
170 def client_error?(code)
171 code.to_i >= 400 and code.to_i < 500
175 # Is +code+ a server error status?
176 def server_error?(code)
177 code.to_i >= 500 and code.to_i < 600
181 # Returns the status class corresponding to +code+
186 def self.[](code)
187 CodeToError[code]