Method: Cuboid::Application.spawn

Defined in:
lib/cuboid/application.rb

.spawn(type, options = {}, &block) ⇒ Object



187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/cuboid/application.rb', line 187

def spawn( type, options = {}, &block )
    const = nil

    case type
    when :instance
        const = :Instances
    when :agent
        const = :Agents
    when :scheduler
        const = :Schedulers
    when :rest
        return Processes::Manager.spawn(
            :rest_service,
            options.merge( options: { paths: { application: source_location } } ),
            &block
        )
    end

    Processes.const_get( const ).spawn(
      options.merge( application: source_location ),
      &block
    )
end