Sha256: 5f7eb3946f87fa142058436bba9714293341adcb0f9bc7636e4894b393d9cac2

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

require "sidekiq/web/helpers"
require "sidekiq/web/action"

module Sidekiq
  module WebActionHelper
    def render(engine, content, options = {})
      begin
        path_info = /"([^"]*)"/.match(block.source.to_s)[1]
      rescue StandardError
        path_info = nil
      end

      path_info ||= ::Rack::Utils.unescape(env["PATH_INFO"])

      Sidekiq::Config::DEFAULTS[:replace_views].fetch(path_info.to_s, []).each do |content_block|
        content_block.call(content)
      end

      super(engine, content, options)
    end
  end

  Sidekiq::WebAction.prepend(Sidekiq::WebActionHelper)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sidekiq-belt-0.3.1 lib/sidekiq/web_action_helper.rb
sidekiq-belt-0.3.0 lib/sidekiq/web_action_helper.rb