module Sidekiq::WebCustom

Constants

BREAK_BIT
MAJOR
MINOR
PATCH
VERSION

Public Class Methods

actions_root() click to toggle source
# File lib/sidekiq/web_custom.rb, line 45
def self.actions_root
  @actions_root ||= "#{local_erbs_root}/actions"
end
config() click to toggle source
# File lib/sidekiq/web_custom.rb, line 57
def self.config
  @config ||= Configuration.new.tap do |t|
    t.merge(base: :actions, params: default_available_actions_mapping)
    t.merge(base: :local_erbs, params: default_local_erb_mapping)
  end
end
configure() { |config| ... } click to toggle source
# File lib/sidekiq/web_custom.rb, line 64
def self.configure
  yield config if block_given?

  config.validate!
  __inject_dependencies
end
default_available_actions_mapping() click to toggle source
# File lib/sidekiq/web_custom.rb, line 24
def self.default_available_actions_mapping
  @available_actions_mapping ||= begin
    temp = {}
    Dir["#{actions_root}/**/*.erb"].map do |erb_path|
      base_path = File.basename(erb_path).split('.')[0]
      second_half = erb_path.split(actions_root)[1]
      action_type = second_half.split(base_path)[0]
      action_type = action_type.delete('/').to_sym
      temp[action_type] ||= {}
      temp[action_type][base_path.to_sym] = erb_path
    end
    temp
  end
end
default_local_erb_mapping() click to toggle source
# File lib/sidekiq/web_custom.rb, line 39
def self.default_local_erb_mapping
  @local_erb_mapping ||= Dir["#{local_erbs_root}/*.erb"].map do |erb_path|
    [File.basename(erb_path).split('.')[0].to_sym, erb_path]
  end.to_h
end
get_version() click to toggle source
# File lib/sidekiq/web_custom/version.rb, line 10
def self.get_version
  puts VERSION
end
local_erb_mapping() click to toggle source
# File lib/sidekiq/web_custom.rb, line 71
def self.local_erb_mapping
  config.local_erbs
end
local_erbs_root() click to toggle source
# File lib/sidekiq/web_custom.rb, line 49
def self.local_erbs_root
  @local_erbs_root ||= "#{root_path}/views"
end
reset!() click to toggle source
# File lib/sidekiq/web_custom.rb, line 75
def self.reset!
  @config = nil
end
root_path() click to toggle source
# File lib/sidekiq/web_custom.rb, line 53
def self.root_path
  @root_path ||= File.dirname(__FILE__)
end

Private Class Methods

__inject_dependencies() click to toggle source
# File lib/sidekiq/web_custom.rb, line 81
def self.__inject_dependencies
  return if @__already_called

  @__already_called = true
  ::Sidekiq::WebAction.prepend WebAction
  ::Sidekiq::Queue.prepend Queue
  ::Sidekiq::Job.prepend Job
  ::Sidekiq::Web.register WebApp
end