Class: Raki::Require

Inherits:
Middleware show all
Defined in:
lib/raki/require.rb

Instance Attribute Summary

Attributes inherited from Middleware

#app

Instance Method Summary collapse

Methods inherited from Middleware

#initialize

Constructor Details

This class inherits a constructor from Raki::Middleware

Instance Method Details

#call(env) ⇒ Object

Raises:



8
9
10
11
12
13
14
# File 'lib/raki/require.rb', line 8

def call(env)
  expected = @args.flatten.sort
  bool = env.keys.sort == expected
  raise(RequireError, "Expected <#{expected.join}>") unless bool

  @app&.call(env)
end