vendor/seahorse/lib/seahorse/client/handler_list.rb
# Registers a handler.  Handlers are used to build a handler stack.
# Handlers default to the `:build` step with default priority of 50.
# The step and priority determine where in the stack a handler
# will be.
#
# ## Handler Stack Ordering
#
# A handler stack is built from the inside-out.  The stack is
# seeded with the send handler.  Handlers are constructed recursively
# in reverse step and priority order so that the highest priority
# handler is on the outside.
#
# By constructing the stack from the inside-out, this ensures
# that the validate handlers will be called first and the sign handlers
# will be called just before the final and only send handler is called.
#
# ## Steps
#
# Handlers are ordered first by step.  These steps represent the
# life-cycle of a request.  Valid steps are:
#
# * `:initialize`
# * `:validate`
# * `:build`
# * `:sign`
# * `:send`
#
# Many handlers can be added to the same step, except for `:send`.
# There can be only one `:send` handler.  Adding an additional
# `:send` handler replaces the previous one.
#
# ## Priorities
#
# Handlers within a single step are executed in priority order.  The
# higher the priority, the earlier in the stack the handler will
# be called.
#
# * Handler priority is an integer between 0 and 99, inclusively.
# * Handler priority defaults to 50.
# * When multiple handlers are added to the same step with the same
#   priority, the last one added will have the highest priority and
#   the first one added will have the lowest priority.
#
# @param [Class<Handler>] handler This should be a subclass
#   of {Handler} or anany class that construct an object that
#   responds to `#call`.
#
# @option options [Symbol] :step (:build) The request life-cycle
#   step the handler should run in.  Defaults to `:build`.  The
#   list of possible steps, in high-to-low priority order are:
#
#   * `:validate`
#   * `:build`
#   * `:sign`
#   * `:send`
#
#   There can only be one send handler. Registering an additional
#   `:send` handler replaces the previous one.
#
# @option options [Integer] :priority (50) The priority of this
#   handler within a step.  The priority must be between 0 and 99
#   inclusively.  It defaults to 50.  When two handlers have the
#   same `:step` and `:priority`, the handler registered last has
#   the highest priority.
#
# @option options [Array<Symbol,String>] :operations A list of
#   operations names the handler should be applied to.  When
#   `:operations` is omitted, the handler is applied to all
#   operations for the client.
#
# @raise [InvalidStepError]
# @raise [InvalidPriorityError]
# @note There can be only one `:send` handler.  Adding an additional
#   send handler replaces the previous.
#
# @return [Class<Handler>] Returns the handler class that was added.
#
Registers a handler.  Handlers are used to build a handler stack.
Handlers default to the `:build` step with default priority of 50.
The step and priority determine where in the stack a handler
will be.

Handler Stack Ordering

A handler stack is built from the inside-out.  The stack is
seeded with the send handler.  Handlers are constructed recursively
in reverse step and priority order so that the highest priority
handler is on the outside.

By constructing the stack from the inside-out, this ensures
that the validate handlers will be called first and the sign handlers
will be called just before the final and only send handler is called.

Steps

Handlers are ordered first by step.  These steps represent the
life-cycle of a request.  Valid steps are.



Many handlers can be added to the same step, except for `:send`.
There can be only one `:send` handler.  Adding an additional
`:send` handler replaces the previous one.

Priorities

Handlers within a single step are executed in priority order.  The
higher the priority, the earlier in the stack the handler will
be called.

Handler priority is an integer between 0 and 99, inclusively.
Handler priority defaults to 50.
When multiple handlers are added to the same step with the same
priority, the last one added will have the highest priority and
the first one added will have the lowest priority.
Registers a handler . Handlers are used to build a handler stack . Handlers default to the ` : build ` step with default priority of 50 . The step and priority determine where in the stack a handler will be . Handler Stack Ordering A handler stack is built from the inside - out . The stack is seeded with the send handler . Handlers are constructed recursively in reverse step and priority order so that the highest priority handler is on the outside . By constructing the stack from the inside - out this ensures that the validate handlers will be called first and the sign handlers will be called just before the final and only send handler is called . Steps Handlers are ordered first by step . These steps represent the life - cycle of a request . Valid steps are . Many handlers can be added to the same step except for ` : send ` . There can be only one ` : send ` handler . Adding an additional ` : send ` handler replaces the previous one . Priorities Handlers within a single step are executed in priority order . The higher the priority the earlier in the stack the handler will be called . Handler priority is an integer between 0 and 99 inclusively . Handler priority defaults to 50 . When multiple handlers are added to the same step with the same priority the last one added will have the highest priority and the first one added will have the lowest priority .
def add(handler, options = {})
        @mutex.synchronize do
          add_entry(Entry.new(handler, next_index, options))
        end
        handler
      end
def add ( handler , options = { } ) @mutex . synchronize do add_entry ( Entry . new ( handler , next_index , options ) ) end handler end
Registers a handler.
Registers a handler .
Returns the handler class that was added.
Returns the handler class that was added .
Class<Handler>
None
None
handler
options
:operations A list of operations names the handler should be applied to. When `:operations` is omitted, the handler is applied to all operations for the client.
: operations A list of operations names the handler should be applied to . When ` : operations ` is omitted the handler is applied to all operations for the client .
handler This should be a subclass of {Handler} or anany class that construct an object that responds to `#call`.
handler This should be a subclass of { Handler } or anany class that construct an object that responds to ` #call ` .
note
There can be only one `:send` handler. Adding an additional send handler replaces the previous.
There can be only one ` : send ` handler . Adding an additional send handler replaces the previous .