lib/goliath/api.rb
# Retrieves the middlewares defined by this API server
#
# @return [Array] array contains [middleware class, args, block]
Retrieves the middlewares defined by this API server
Retrieves the middlewares defined by this API server
def middlewares
        @middlewares ||= []
        unless @loaded_superclass_middlewares
          if self.superclass != Goliath::API
            @middlewares = self.superclass.middlewares + @middlewares
            @middlewares = @middlewares.uniq
          end
          @loaded_superclass_middlewares = true
        end
        unless @loaded_default_middlewares
          @middlewares.unshift([::Goliath::Rack::DefaultResponseFormat, nil, nil])
          @middlewares.unshift([::Rack::ContentLength, nil, nil])
          if Goliath.dev? && !@middlewares.detect {|mw| mw.first == ::Rack::Reloader}
            @middlewares.unshift([::Rack::Reloader, 0, nil])
          end
          @loaded_default_middlewares = true
        end
        @middlewares
      end
def middlewares @middlewares ||= [ ] unless @loaded_superclass_middlewares if self . superclass != Goliath :: API @middlewares = self . superclass . middlewares + @middlewares @middlewares = @middlewares . uniq end @loaded_superclass_middlewares = true end unless @loaded_default_middlewares @middlewares . unshift ( [ :: Goliath :: Rack :: DefaultResponseFormat , nil , nil ] ) @middlewares . unshift ( [ :: Rack :: ContentLength , nil , nil ] ) if Goliath . dev? && ! @middlewares . detect { | mw | mw . first == :: Rack :: Reloader } @middlewares . unshift ( [ :: Rack :: Reloader , 0 , nil ] ) end @loaded_default_middlewares = true end @middlewares end
Retrieves the middlewares defined by this API server
Retrieves the middlewares defined by this API server
array contains [middleware class, args, block]
array contains [ middleware class args block ]
Array