Sha256: 95318cae85c9dac3c4587c61a7d86f077c705504e85343e8d0090de29b5c56ec

Contents?: true

Size: 1.08 KB

Versions: 69

Compression:

Stored size: 1.08 KB

Contents

# frozen-string-literal: true

#
class Roda
  module RodaPlugins
    # Internal before hook module, not for external use.
    # Allows for plugins to configure the order in which
    # before processing is done by using _roda_before_*
    # private instance methods that are called in sorted order.
    # Loaded automatically by the base library if any _roda_before_*
    # methods are defined.
    module BeforeHook # :nodoc:
      module InstanceMethods
        # Run internal before hooks - Old Dispatch API.
        def call(&block)
          # RODA4: Remove
          super do
            _roda_before
            instance_exec(@_request, &block) # call Fallback
          end
        end

        # Run internal before hooks before running the main
        # roda route.
        def _roda_run_main_route(r)
          _roda_before
          super
        end

        private

        # Default empty implementation of _roda_before, usually
        # overridden by Roda.def_roda_before.
        def _roda_before
        end
      end
    end

    register_plugin(:_before_hook, BeforeHook)
  end
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
roda-3.65.0 lib/roda/plugins/_before_hook.rb
roda-3.64.0 lib/roda/plugins/_before_hook.rb
roda-3.63.0 lib/roda/plugins/_before_hook.rb
roda-3.62.0 lib/roda/plugins/_before_hook.rb
roda-3.61.0 lib/roda/plugins/_before_hook.rb
roda-3.60.0 lib/roda/plugins/_before_hook.rb
roda-3.59.0 lib/roda/plugins/_before_hook.rb
roda-3.58.0 lib/roda/plugins/_before_hook.rb
roda-3.57.0 lib/roda/plugins/_before_hook.rb
roda-3.56.0 lib/roda/plugins/_before_hook.rb
roda-3.55.0 lib/roda/plugins/_before_hook.rb
roda-3.54.0 lib/roda/plugins/_before_hook.rb
roda-3.53.0 lib/roda/plugins/_before_hook.rb
roda-3.52.0 lib/roda/plugins/_before_hook.rb
roda-3.51.0 lib/roda/plugins/_before_hook.rb
roda-3.50.0 lib/roda/plugins/_before_hook.rb
roda-3.49.0 lib/roda/plugins/_before_hook.rb
roda-3.48.0 lib/roda/plugins/_before_hook.rb
roda-3.47.0 lib/roda/plugins/_before_hook.rb
roda-3.46.0 lib/roda/plugins/_before_hook.rb