Module: Sidekiq::Tasks::Web::Helpers::ApplicationHelper

Extended by:
ApplicationHelper
Included in:
ApplicationHelper
Defined in:
lib/sidekiq/tasks/web/helpers/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#authorize!Object



28
29
30
31
32
# File 'lib/sidekiq/tasks/web/helpers/application_helper.rb', line 28

def authorize!
  return if Sidekiq::Tasks.config.authorization.call(env)

  throw :halt, [403, {"Content-Type" => "text/plain"}, ["Forbidden"]]
end

#current_envObject



12
13
14
# File 'lib/sidekiq/tasks/web/helpers/application_helper.rb', line 12

def current_env
  ENV["RAILS_ENV"] || ENV["RACK_ENV"]
end

#fetch_param(key) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/sidekiq/tasks/web/helpers/application_helper.rb', line 16

def fetch_param(key)
  if Sidekiq::Tasks::Web::SIDEKIQ_GTE_8_0_0
    url_params(key.to_s)
  else
    params[key.to_s]
  end
end

#fetch_params(*keys) ⇒ Object



24
25
26
# File 'lib/sidekiq/tasks/web/helpers/application_helper.rb', line 24

def fetch_params(*keys)
  keys.to_h { |key| [key.to_sym, fetch_param(key)] }
end

#read_view(name) ⇒ Object



8
9
10
# File 'lib/sidekiq/tasks/web/helpers/application_helper.rb', line 8

def read_view(name)
  File.read(File.join(Sidekiq::Tasks::Web::ROOT, "views", "#{name}.erb"))
end