Class: Sidekiq::WebActionHelper::ERB

Inherits:
ERB
  • Object
show all
Defined in:
lib/sidekiq/web_action_helper.rb

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ ERB

Returns a new instance of ERB.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/sidekiq/web_action_helper.rb', line 9

def initialize(content)
  replace_views = Sidekiq::Config::DEFAULTS[:replace_views] || {}

  replace_views.each do |key, content_blocks|
    router = Sidekiq::Web::Route.new(self.class.sidekiq_request_method, key, true)

    next if router.match(self.class.sidekiq_request_method, self.class.sidekiq_path_info).nil?

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

  super
end

Class Attribute Details

.sidekiq_path_infoObject

Returns the value of attribute sidekiq_path_info.



26
27
28
# File 'lib/sidekiq/web_action_helper.rb', line 26

def sidekiq_path_info
  @sidekiq_path_info
end

.sidekiq_request_methodObject

Returns the value of attribute sidekiq_request_method.



26
27
28
# File 'lib/sidekiq/web_action_helper.rb', line 26

def sidekiq_request_method
  @sidekiq_request_method
end