Class: Toys::Middleware::Stack

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

Overview

Defined in the toys-core gem

A stack of middleware specs, which can be applied in order to a tool.

A middleware stack is separated into three groups:

  • #pre_specs, which are applied first.
  • #default_specs, which are applied next. The default specs are set when the stack is created and are generally not modified.
  • #post_specs, which are applied third.

When adding middleware to a stack, you should normally add them to the pre or post specs. By default, #add appends to the pre specs, inserting new middleware just before the defaults.

Use stack to create a middleware stack.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_specsArray<Toys::Middleware:Spec> (readonly)

The default set of middleware specs.

Returns:

  • (Array<Toys::Middleware:Spec>)


267
268
269
# File 'core-docs/toys/middleware.rb', line 267

def default_specs
  @default_specs
end

#post_specsArray<Toys::Middleware:Spec> (readonly)

The middleware specs that follow the default set.

Returns:

  • (Array<Toys::Middleware:Spec>)


273
274
275
# File 'core-docs/toys/middleware.rb', line 273

def post_specs
  @post_specs
end

#pre_specsArray<Toys::Middleware:Spec> (readonly)

The middleware specs that precede the default set.

Returns:

  • (Array<Toys::Middleware:Spec>)


261
262
263
# File 'core-docs/toys/middleware.rb', line 261

def pre_specs
  @pre_specs
end

Instance Method Details

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

Equality check

Parameters:

  • other (Object)

Returns:

  • (Boolean)


312
313
314
# File 'core-docs/toys/middleware.rb', line 312

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

#add(name, *args, **kwargs, &block) ⇒ Object #add(array) ⇒ Object #add(middleware_object) ⇒ Object

Add a middleware spec to the stack, in the default location, which is at the end of pre_specs). See Toys::Middleware.spec for a description of the arguments you can pass.



284
285
286
# File 'core-docs/toys/middleware.rb', line 284

def add(middleware, *args, **kwargs, &block)
  # Source available in the toys-core gem
end

#build(middleware_lookup) ⇒ Array<Toys::Middleware>

Build the middleware in this stack.

Returns:



302
303
304
# File 'core-docs/toys/middleware.rb', line 302

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

#dupToys::Middleware::Stack

Duplicate this stack.



293
294
295
# File 'core-docs/toys/middleware.rb', line 293

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

#hashInteger

Return the hash code

Returns:

  • (Integer)


322
323
324
# File 'core-docs/toys/middleware.rb', line 322

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