Module: Celluloid::Supervision::Container::Behavior

### Home Classes Methods

### In Files

- lib/celluloid/supervision/container/behavior.rb

### Namespace

- MODULE Celluloid::Supervision::Container::Behavior::ClassMethods
- MODULE Celluloid::Supervision::Container::Behavior::Error

### Methods

- ::[]
- ::[]=
- ::configure
- ::included
- ::injections
- ::parameter

### Class/Module Index

Quicksearch

- Celluloid
- Celluloid::ClassMethods
- Celluloid::Supervision
- Celluloid::Supervision::Configuration
- Celluloid::Supervision::Configuration::Error
- Celluloid::Supervision::Configuration::Error::AlreadyDefined
- Celluloid::Supervision::Configuration::Error::Incomplete
- Celluloid::Supervision::Configuration::Error::Invalid
- Celluloid::Supervision::Configuration::Error::InvalidSupervisor
- Celluloid::Supervision::Configuration::Error::InvalidValues
- Celluloid::Supervision::Configuration::Injection
- Celluloid::Supervision::Configuration::Instance
- Celluloid::Supervision::Container
- Celluloid::Supervision::Container::Behavior
- Celluloid::Supervision::Container::Behavior::ClassMethods
- Celluloid::Supervision::Container::Behavior::Error
- Celluloid::Supervision::Container::Behavior::Error::Mutant
- Celluloid::Supervision::Container::Injection
- Celluloid::Supervision::Container::Instance
- Celluloid::Supervision::Container::Tree
- Celluloid::Supervision::Error
- Celluloid::Supervision::Error::NoPublicService
- Celluloid::Supervision::Service
- Celluloid::Supervision::Service::Public
- Celluloid::Supervision::Service::Root
- Celluloid::Supervisor

No matching classes.

# Celluloid::Supervision::Container::Behavior

### Public Class Methods

[](identifier) click to toggle source

    # File lib/celluloid/supervision/container/behavior.rb, line 21
    def [](identifier)
      @@behaviors[identifier]
    end

[]=(identifier, behavior) click to toggle source

    # File lib/celluloid/supervision/container/behavior.rb, line 25
    def []=(identifier, behavior)
      @@behaviors[identifier] = behavior
    end

configure(options) click to toggle source

Beware of order. There may be multiple behavior injections, but their order is not determined ( yet ) Right now, something like a pool-coordinator-tree supervisor mutant are absolutely expected to crash. Therefore, sorry Professor X -- we kill every Mutant. On sight, no questions asked. Zero mutant love.

    # File lib/celluloid/supervision/container/behavior.rb, line 45
    def configure(options)
      behavior = nil
      injection = nil
      @@behaviors.map do |identifier, injector|
        if identifier = parameter(identifier, options)
          if behavior
            fail Error::Mutant.new("More than one type of behavior expected.")
          else
            if @@injections[injector].include?(:configuration)
              injection = @@injections[behavior = injector][:configuration]
              options[:behavior] ||= behavior
            end
          end
        end
      end

      options[:type] ||= behavior
      injection || proc { @configuration }
    end

included(klass) click to toggle source

    # File lib/celluloid/supervision/container/behavior.rb, line 13
    def included(klass)
      klass.send :extend, ClassMethods
    end

injections() click to toggle source

    # File lib/celluloid/supervision/container/behavior.rb, line 17
    def injections
      @@injections
    end

parameter(identifier, options) click to toggle source

    # File lib/celluloid/supervision/container/behavior.rb, line 29
    def parameter(identifier, options)
      found = nil
      p = Configuration.aliases.inject([identifier]) { |invoke, (a, i)| invoke << a if i == identifier; invoke }
      case p.select { |parameter| found = parameter; options.key?(parameter) }.count
      when 1
        found
      when 0

      else
        fail Error::Mutant.new("More than one kind of identifiable behavior parameter.")
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.