Module: SidekiqUniqueJobs::Web::Helpers
- Defined in:
- lib/sidekiq_unique_jobs/web/helpers.rb
Constant Summary collapse
- VIEW_PATH =
File.('../web/views', __dir__)
Instance Method Summary collapse
Instance Method Details
#redirect_to(subpath) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/sidekiq_unique_jobs/web/helpers.rb', line 12 def redirect_to(subpath) if respond_to?(:to) # Sinatra-based web UI redirect to(subpath) else # Non-Sinatra based web UI (Sidekiq 4.2+) redirect "#{root_path}#{subpath}" end end |
#safe_relative_time(time) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/sidekiq_unique_jobs/web/helpers.rb', line 22 def safe_relative_time(time) time = if time.is_a?(Numeric) Time.at(time) else Time.parse(time) end relative_time(time) end |
#unique_template(name) ⇒ Object
8 9 10 |
# File 'lib/sidekiq_unique_jobs/web/helpers.rb', line 8 def unique_template(name) File.open(File.join(VIEW_PATH, "#{name}.erb")).read end |