Class: SidekiqAdminEnquerer::WebApp::JobMethodWrapper Private

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_admin_enquerer/web_app/job_method_wrapper.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Constant Summary collapse

JOB_INVOCATION_METHODS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Returns:

  • (Array<Symbol>)

Since:

  • 0.1.0

%i[
  perform
  perform_in
  perform_async
  perform_at
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, name, params) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

Since:

  • 0.1.0



60
61
62
63
64
# File 'lib/sidekiq_admin_enquerer/web_app/job_method_wrapper.rb', line 60

def initialize(job, name, params)
  @job = job
  @name = name
  @params = params
end

Instance Attribute Details

#jobClass<ActiveJob::Base>, Class<Sidekiq::Worker> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Class<ActiveJob::Base>, Class<Sidekiq::Worker>)

Since:

  • 0.1.0



39
40
41
# File 'lib/sidekiq_admin_enquerer/web_app/job_method_wrapper.rb', line 39

def job
  @job
end

#nameSymbol (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Symbol)

Since:

  • 0.1.0



45
46
47
# File 'lib/sidekiq_admin_enquerer/web_app/job_method_wrapper.rb', line 45

def name
  @name
end

#paramsArray<SidekiqAdminEnquerer::WebApp::JobParamWrapper> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • 0.1.0



51
52
53
# File 'lib/sidekiq_admin_enquerer/web_app/job_method_wrapper.rb', line 51

def params
  @params
end

Class Method Details

.extract_methods_from(job) ⇒ Array<SidekiqAdminEnquerer::WebApp::JobMethodWrapper>

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • job (Class<ActiveJob::Base>, Class<Sidekiq::Worker])

    ob [Class<ActiveJob::Base>, Class<Sidekiq::Worker]

Returns:

Since:

  • 0.1.0



23
24
25
26
27
28
29
30
31
32
# File 'lib/sidekiq_admin_enquerer/web_app/job_method_wrapper.rb', line 23

def extract_methods_from(job)
  job.instance_methods.select do |method|
    JOB_INVOCATION_METHODS.include?(method)
  end.each_with_object([]) do |method, aggregate|
    parameters = job.instance_method(method).parameters.map do |(req, name)|
      SidekiqAdminEnquerer::WebApp::JobParamWrapper.new(job, method, name, req)
    end # => Array<JobParamWrapper>
    aggregate << new(job, method, parameters) # => JobMethodWrapper
  end
end