Class: Toys::Middleware::Spec

Inherits:
Object
  • Object
show all
Defined in:
core-docs/toys/middleware.rb

Overview

A middleware specification, including the middleware class and the arguments to pass to the constructor.

Use spec to create a middleware spec.

Defined in the toys-core gem

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsArray? (readonly)

Returns:

  • (Array)

    the positional arguments to be passed to a middleware class constructor, or the empty array if there are no positional arguments

  • (nil)

    if this spec wraps a middleware object



182
183
184
# File 'core-docs/toys/middleware.rb', line 182

def args
  @args
end

#blockProc? (readonly)

Returns:

  • (Proc)

    if there is a block argument to be passed to a middleware class constructor

  • (nil)

    if there is no block argument, or this spec wraps a middleware object



197
198
199
# File 'core-docs/toys/middleware.rb', line 197

def block
  @block
end

#kwargsHash? (readonly)

Returns:

  • (Hash)

    the keyword arguments to be passed to a middleware class constructor, or the empty hash if there are no keyword arguments

  • (nil)

    if this spec wraps a middleware object



189
190
191
# File 'core-docs/toys/middleware.rb', line 189

def kwargs
  @kwargs
end

#nameString, ... (readonly)

Returns:

  • (String, Symbol)

    if this spec represents a middleware name

  • (Class)

    if this spec represents a middleware class

  • (nil)

    if this spec wraps a middleware object



174
175
176
# File 'core-docs/toys/middleware.rb', line 174

def name
  @name
end

#objectToys::Middleware? (readonly)

Returns:

  • (Toys::Middleware)

    if this spec wraps a middleware object

  • (nil)

    if this spec represents a class to instantiate



167
168
169
# File 'core-docs/toys/middleware.rb', line 167

def object
  @object
end

Instance Method Details

#==(other) ⇒ boolean Also known as: eql?

Equality check

Parameters:

  • other (Object)

Returns:

  • (boolean)


205
206
207
# File 'core-docs/toys/middleware.rb', line 205

def ==(other)
  # Source available in the toys-core gem
end

#build(lookup) ⇒ Toys::Middleware

Builds a middleware for this spec, given a ModuleLookup for middleware.

If this spec wraps an existing middleware object, returns that object. Otherwise, constructs a middleware object from the spec.

Parameters:

Returns:



159
160
161
# File 'core-docs/toys/middleware.rb', line 159

def build(lookup)
  # Source available in the toys-core gem
end

#hashInteger

Return the hash code

Returns:

  • (Integer)


215
216
217
# File 'core-docs/toys/middleware.rb', line 215

def hash
  # Source available in the toys-core gem
end