Class: FlowChat::BackgroundRequestBody

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_chat/async_job.rb

Overview

Body wrapper for BackgroundRequest Provides read() method that Rails expects

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ BackgroundRequestBody

Returns a new instance of BackgroundRequestBody.



171
172
173
174
# File 'lib/flow_chat/async_job.rb', line 171

def initialize(content)
  @content = content
  @read = false
end

Instance Method Details

#readObject



176
177
178
179
180
# File 'lib/flow_chat/async_job.rb', line 176

def read
  return "" if @read
  @read = true
  @content
end

#rewindObject



182
183
184
# File 'lib/flow_chat/async_job.rb', line 182

def rewind
  @read = false
end