Class List Method List File List

# Class: Concurrent::Actor::Behaviour::Abstract

Inherits:
  Object
  - Object
  - Concurrent::Actor::Behaviour::Abstract
  show all
Includes:
  InternalDelegations, TypeCheck
Defined in:
  lib/concurrent/actor/behaviour/abstract.rb

## Direct Known Subclasses

Awaits, Buffer, ErrorsOnUnknownMessage, ExecutesContext, Linking, Pausing, RemovesChild, SetResults, Supervising, Termination

## Instance Attribute Summary (collapse)

- - (undocumented) core readonly
- - (undocumented) subsequent readonly

## Instance Method Summary (collapse)

- - (undocumented) behaviour(behaviour_class) included from InternalDelegations

  see Core#behaviour.

- - (undocumented) behaviour!(behaviour_class) included from InternalDelegations

  see Core#behaviour!.

- - (undocumented) broadcast(public, event)

  broadcasts event to all behaviours and context.

- - (undocumented) Child!(value, *types) included from TypeCheck
- - (Boolean) Child?(value, *types) included from TypeCheck
- - (undocumented) children included from InternalDelegations
- - (AbstractContext) context included from InternalDelegations
- - (undocumented) context_class (also: #actor_class) included from PublicDelegations
- - (undocumented) dead_letter_routing included from InternalDelegations
- - (undocumented) executor included from PublicDelegations
- - (Abstract) initialize(core, subsequent, core_options) constructor

  A new instance of Abstract.

- - (undocumented) log(level, message = nil, &block) included from InternalDelegations

  delegates to core.log.

- - (undocumented) Match!(value, *types) included from TypeCheck
- - (Boolean) Match?(value, *types) included from TypeCheck
- - (undocumented) name included from PublicDelegations
- - (undocumented) on_envelope(envelope)

  override to add extra behaviour.

- - (undocumented) on_event(public, event)

  override to add extra behaviour.

- - (undocumented) parent included from PublicDelegations
- - (undocumented) pass(envelope)
- - (undocumented) path included from PublicDelegations
- - (undocumented) redirect(reference, envelope = self.envelope) included from InternalDelegations
- - (undocumented) reference (also: #ref) included from PublicDelegations
- - (undocumented) reject_envelope(envelope)
- - (undocumented) terminate!(reason = nil) included from InternalDelegations
- - (Boolean) terminated? included from InternalDelegations
- - (undocumented) Type!(value, *types) included from TypeCheck
- - (Boolean) Type?(value, *types) included from TypeCheck

## Constructor Details

### - (`Abstract`) initialize(core, subsequent, core_options)

Returns a new instance of Abstract

    12
    13
    14
    15

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 12

    def initialize(core, subsequent, core_options)
      @core       = Type! core, Core
      @subsequent = Type! subsequent, Abstract, NilClass
    end

## Instance Attribute Details

### - (`undocumented`) core (readonly)

    10
    11
    12

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 10

    def core
      @core
    end

### - (`undocumented`) subsequent (readonly)

    10
    11
    12

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 10

    def subsequent
      @subsequent
    end

## Instance Method Details

### - (`undocumented`) behaviour(behaviour_class) Originally defined in module InternalDelegations

see Core#behaviour

### - (`undocumented`) behaviour!(behaviour_class) Originally defined in module InternalDelegations

see Core#behaviour!

### - (`undocumented`) broadcast(public, event)

broadcasts event to all behaviours and context

See Also:

- #on_event
- AbstractContext#on_event

    37
    38
    39

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 37

    def broadcast(public, event)
      core.broadcast(public, event)
    end

### - (`undocumented`) Child!(value, *types) Originally defined in module TypeCheck

### - (`Boolean`) Child?(value, *types) Originally defined in module TypeCheck

Returns:

- (`Boolean`)

### - (`undocumented`) children Originally defined in module InternalDelegations

See Also:

- Core#children

### - (`AbstractContext`) context Originally defined in module InternalDelegations

Returns:

- (`AbstractContext`)

### - (`undocumented`) context_class Also known as: actor_class Originally defined in module PublicDelegations

See Also:

- Core#context_class

### - (`undocumented`) dead_letter_routing Originally defined in module InternalDelegations

See Also:

- AbstractContext#dead_letter_routing

### - (`undocumented`) executor Originally defined in module PublicDelegations

See Also:

- Core#executor

### - (`undocumented`) log(level, message = nil, &block) Originally defined in module InternalDelegations

delegates to core.log

See Also:

- Logging#log

### - (`undocumented`) Match!(value, *types) Originally defined in module TypeCheck

### - (`Boolean`) Match?(value, *types) Originally defined in module TypeCheck

Returns:

- (`Boolean`)

### - (`undocumented`) name Originally defined in module PublicDelegations

See Also:

- Core#name

### - (`undocumented`) on_envelope(envelope)

Note:

super needs to be called not to break the chain

override to add extra behaviour

    19
    20
    21

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 19

    def on_envelope(envelope)
      pass envelope
    end

### - (`undocumented`) on_event(public, event)

Note:

super needs to be called not to break the chain

override to add extra behaviour

    30
    31
    32

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 30

    def on_event(public, event)
      subsequent.on_event public, event if subsequent
    end

### - (`undocumented`) parent Originally defined in module PublicDelegations

See Also:

- Core#parent

### - (`undocumented`) pass(envelope)

Parameters:

- envelope (`Envelope`) —

  to pass to #subsequent behaviour

    24
    25
    26

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 24

    def pass(envelope)
      subsequent.on_envelope envelope
    end

### - (`undocumented`) path Originally defined in module PublicDelegations

See Also:

- Core#path

### - (`undocumented`) redirect(reference, envelope = self.envelope) Originally defined in module InternalDelegations

### - (`undocumented`) reference Also known as: ref Originally defined in module PublicDelegations

See Also:

- Core#reference

### - (`undocumented`) reject_envelope(envelope)

    41
    42
    43
    44
    45

    # File 'lib/concurrent/actor/behaviour/abstract.rb', line 41

    def reject_envelope(envelope)
      envelope.reject! ActorTerminated.new(reference)
      dead_letter_routing << envelope unless envelope.future
      log(DEBUG) { "rejected #{envelope.message} from #{envelope.sender_path}"}
    end

### - (`undocumented`) terminate!(reason = nil) Originally defined in module InternalDelegations

See Also:

- Termination#terminate!

### - (`Boolean`) terminated? Originally defined in module InternalDelegations

Returns:

- (`Boolean`)

See Also:

- Termination#terminated?

### - (`undocumented`) Type!(value, *types) Originally defined in module TypeCheck

### - (`Boolean`) Type?(value, *types) Originally defined in module TypeCheck

Returns:

- (`Boolean`)