Exception: Rackful::HTTPStatus Abstract
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- Rackful::HTTPStatus
- Defined in:
- lib/rackful/httpstatus.rb
Overview
This class is abstract.
Exception which represents an HTTP Status response.
Direct Known Subclasses
HTTP201Created, HTTP202Accepted, HTTP301MovedPermanently, HTTP303SeeOther, HTTP304NotModified, HTTP307TemporaryRedirect, HTTP405MethodNotAllowed, HTTP406NotAcceptable, HTTP412PreconditionFailed, HTTP415UnsupportedMediaType, HTTPSimpleStatus
Defined Under Namespace
Classes: Resource
Instance Attribute Summary (collapse)
-
- (void) headers
readonly
Returns the value of attribute headers.
-
- (void) status
readonly
Returns the value of attribute status.
-
- (void) to_rackful
readonly
Returns the value of attribute to_rackful.
Instance Method Summary (collapse)
-
- (HTTPStatus) initialize(status, message = nil, info = {})
constructor
A new instance of HTTPStatus.
- - (void) serializer(request)
- - (void) title
Constructor Details
- (HTTPStatus) initialize(status, message = nil, info = {})
Returns a new instance of HTTPStatus
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/rackful/httpstatus.rb', line 61 def initialize status, = nil, info = {} @status = Rack::Utils.status_code status raise "Wrong status: #{status}" if 0 === @status ||= '' @headers = {} @to_rackful = {} info.each do |k, v| if k.kind_of? Symbol @to_rackful[k] = v else @headers[k] = v.to_s end end @to_rackful = nil if @to_rackful.empty? if = .to_s begin Nokogiri.XML( '<?xml version="1.0" encoding="UTF-8" ?>' + "<div>#{}</div>" ) do |config| config.strict.nonet end rescue = Rack::Utils.escape_html() end end super end |
Instance Attribute Details
- (void) headers (readonly)
Returns the value of attribute headers
51 52 53 |
# File 'lib/rackful/httpstatus.rb', line 51 def headers @headers end |
- (void) status (readonly)
Returns the value of attribute status
51 52 53 |
# File 'lib/rackful/httpstatus.rb', line 51 def status @status end |
- (void) to_rackful (readonly)
Returns the value of attribute to_rackful
51 52 53 |
# File 'lib/rackful/httpstatus.rb', line 51 def to_rackful @to_rackful end |
Instance Method Details
- (void) serializer(request)
90 91 92 |
# File 'lib/rackful/httpstatus.rb', line 90 def serializer request Resource.new( request.url, self ).serializer( request ) end |
- (void) title
94 95 96 |
# File 'lib/rackful/httpstatus.rb', line 94 def title "#{status} #{Rack::Utils::HTTP_STATUS_CODES[status]}" end |