Class: Celluloid::Application::Supervisable

Inherits:
Object
  • Object
show all
Defined in:
lib/vendor/celluloid/lib/celluloid/application.rb

Overview

A subcomponent of an application to be supervised

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, options = {}) ⇒ Supervisable

Returns a new instance of Supervisable.



63
64
65
66
67
68
69
70
71
# File 'lib/vendor/celluloid/lib/celluloid/application.rb', line 63

def initialize(klass, options = {})
  @klass = klass

  # Stringify keys :/
  options = options.inject({}) { |h,(k,v)| h[k.to_s] = v; h }

  @as = options['as']
  @args = options['args'] || []
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



61
62
63
# File 'lib/vendor/celluloid/lib/celluloid/application.rb', line 61

def args
  @args
end

#asObject (readonly)

Returns the value of attribute as.



61
62
63
# File 'lib/vendor/celluloid/lib/celluloid/application.rb', line 61

def as
  @as
end

#klassObject (readonly)

Returns the value of attribute klass.



61
62
63
# File 'lib/vendor/celluloid/lib/celluloid/application.rb', line 61

def klass
  @klass
end

Instance Method Details

#superviseObject



73
74
75
# File 'lib/vendor/celluloid/lib/celluloid/application.rb', line 73

def supervise
  Supervisor.new_link(@as, @klass, *@args)
end