Sha256: e497ee98d9522a7b0600b6d76157273284964d0ab7919d1ab662090389cd5cd6

Contents?: true

Size: 521 Bytes

Versions: 5

Compression:

Stored size: 521 Bytes

Contents

module ActiveRecordSeek
  class Middleware

    attr_accessor(*%w[ name middleware_block ])

    def initialize(name:, &middleware_block)
      raise(ArgumentError, "#{self.class} expects a block") if !middleware_block
      self.name = name.to_s
      self.middleware_block = middleware_block
      self.class.middleware.push(self)
    end

    def call(*params, &block)
      middleware_block.call(*params, &block)
    end

    class << self
      def middleware
        @middleware ||= []
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_record_seek-0.0.5 lib/active_record_seek/middleware.rb
active_record_seek-0.0.4 lib/active_record_seek/middleware.rb
active_record_seek-0.0.3 lib/active_record_seek/middleware.rb
active_record_seek-0.0.2 lib/active_record_seek/middleware.rb
active_record_seek-0.0.1 lib/active_record_seek/middleware.rb