Class: FlowChat::BackgroundController

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

Overview

Duck-type controller for background jobs Provides render/head no-ops and request interface

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_data) ⇒ BackgroundController

Returns a new instance of BackgroundController.



70
71
72
73
74
# File 'lib/flow_chat/async_job.rb', line 70

def initialize(request_data)
  FlowChat.logger.debug { "BackgroundController: Initializing with request data" }
  @request = BackgroundRequest.new(request_data)
  @response = nil
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



68
69
70
# File 'lib/flow_chat/async_job.rb', line 68

def request
  @request
end

#responseObject (readonly)

Returns the value of attribute response.



68
69
70
# File 'lib/flow_chat/async_job.rb', line 68

def response
  @response
end

Instance Method Details

#head(status) ⇒ Object



87
88
89
90
91
# File 'lib/flow_chat/async_job.rb', line 87

def head(status)
  FlowChat.logger.debug { "BackgroundController: head called (no-op): #{status}" }
  @response = {status: status}
  nil  # No-op in background
end

#is_a?(klass) ⇒ Boolean

Returns:

  • (Boolean)


93
94
95
96
# File 'lib/flow_chat/async_job.rb', line 93

def is_a?(klass)
  return true if klass == FlowChat::BackgroundController
  super
end

#kind_of?(klass) ⇒ Boolean

Returns:

  • (Boolean)


98
99
100
101
# File 'lib/flow_chat/async_job.rb', line 98

def kind_of?(klass)
  return true if klass == FlowChat::BackgroundController
  super
end

#paramsObject

Delegate params to request (mimics Rails controller behavior)



77
78
79
# File 'lib/flow_chat/async_job.rb', line 77

def params
  request.params
end

#render(options) ⇒ Object



81
82
83
84
85
# File 'lib/flow_chat/async_job.rb', line 81

def render(options)
  FlowChat.logger.debug { "BackgroundController: render called (no-op): #{options.inspect}" }
  @response = options
  nil  # No-op in background
end