Sha256: 87caf7cde1a359a468e82cf9102667a72d79586ae62972ce7e24bd6006a4b91a

Contents?: true

Size: 575 Bytes

Versions: 1

Compression:

Stored size: 575 Bytes

Contents

require 'middleware'

module DMV
  # Middleware wraps around Middleware::Builder in order to give us
  # proper cloning for use in inheritance
  #
  class Middleware
    attr_reader :builder

    def initialize
      @builder = ::Middleware::Builder.new
    end

    def method_missing(name, *args, &block)
      if @builder.respond_to?(name)
        return @builder.send(name, *args, &block)
      end

      super
    end

    def stack
      @builder.send(:stack)
    end

    def clone
      cloned = self.class.new
      cloned.use builder
      cloned
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dmv-0.1.0 lib/dmv/middleware.rb