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.



161
162
163
164
# File 'lib/flow_chat/async_job.rb', line 161

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

Instance Method Details

#readObject



166
167
168
169
170
# File 'lib/flow_chat/async_job.rb', line 166

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

#rewindObject



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

def rewind
  @read = false
end