Module: Sidekiq::WebActionHelper

Defined in:
lib/sidekiq/web_action_helper.rb

Defined Under Namespace

Classes: ERB

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.change_layout(&block) ⇒ Object



37
38
39
40
# File 'lib/sidekiq/web_action_helper.rb', line 37

def self.change_layout(&block)
  Sidekiq::Config::DEFAULTS[:layout_changes] ||= []
  Sidekiq::Config::DEFAULTS[:layout_changes] << block
end

Instance Method Details

#_renderObject



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/sidekiq/web_action_helper.rb', line 42

def _render
  content = super

  layout_changes = Sidekiq::Config::DEFAULTS[:layout_changes] || []

  layout_changes.each do |content_block|
    content_block.call(content)
  end

  content
end

#erb(content, options = {}) ⇒ Object



30
31
32
33
34
35
# File 'lib/sidekiq/web_action_helper.rb', line 30

def erb(content, options = {})
  ERB.sidekiq_request_method = env["REQUEST_METHOD"].to_s.downcase
  ERB.sidekiq_path_info = env["PATH_INFO"].to_s

  super
end