Module: Sidekiq::Control::Web::Helpers
- Defined in:
- lib/sidekiq/control/web/helpers.rb
Instance Method Summary collapse
- #display_params(params) ⇒ Object
- #get_job_params(job, params) ⇒ Object
- #link_to(path, text, options = {}) ⇒ Object
- #url_path(path) ⇒ Object
Instance Method Details
#display_params(params) ⇒ Object
15 16 17 18 19 |
# File 'lib/sidekiq/control/web/helpers.rb', line 15 def display_params(params) params.map(&:name).reject { |n| n.start_with?('_') || n.empty? }.tap do |p| return 'None' if p.empty? end.join(', ') end |
#get_job_params(job, params) ⇒ Object
21 22 23 24 25 |
# File 'lib/sidekiq/control/web/helpers.rb', line 21 def get_job_params(job, params) return [] if params[:perform].nil? ParamsParser.values(job, params[:perform]) end |
#link_to(path, text, options = {}) ⇒ Object
7 8 9 |
# File 'lib/sidekiq/control/web/helpers.rb', line 7 def link_to(path, text, ={}) %(<a href="#{url_path(path)}"#{to_attributes()}>#{text}</a>) end |
#url_path(path) ⇒ Object
11 12 13 |
# File 'lib/sidekiq/control/web/helpers.rb', line 11 def url_path(path) "#{root_path}#{path.sub(%r{^/}, '')}" end |