Class: ICAPrb::Server::ResponseBody

Inherits:
String
  • Object
show all
Defined in:
lib/icaprb/server/data_structures.rb

Overview

This class represents the response body which should be sent to the user. If it is missing, it could be replaced by a NullBody

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from String

#chunk_to_s, #to_chunk

Constructor Details

#initialize(string, ieof = false) ⇒ ResponseBody

initializes a new RequestBody which is a String but has an ieof tag additionally.



140
141
142
143
# File 'lib/icaprb/server/data_structures.rb', line 140

def initialize(string, ieof = false)
  super string
  @ieof = ieof
end

Instance Attribute Details

#ieofObject

if it is in the preview, this will be true, otherwise nil or false



137
138
139
# File 'lib/icaprb/server/data_structures.rb', line 137

def ieof
  @ieof
end

Instance Method Details

#<=>(other) ⇒ Object

compare to sort within an array Response Bodies are usually at the end



147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/icaprb/server/data_structures.rb', line 147

def <=>(other)
  case other
    when RequestHeader
      1
    when ResponseHeader
      1
    when RequestBody
      0
    when ResponseBody
      0
    when NullBody
      -1
  end
end