Class: Ruote::ParticipantRegistrationProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/ruote/engine.rb

Overview

Engine#register uses this proxy when it's passed a block.

Originally written by Torsten Schoenebaum for ruote-kit.

Instance Method Summary (collapse)

Constructor Details

- (ParticipantRegistrationProxy) initialize(engine)

A new instance of ParticipantRegistrationProxy



858
859
860
861
# File 'lib/ruote/engine.rb', line 858

def initialize(engine)

  @engine = engine
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

- (Object) method_missing(method_name, *args)

Maybe a bit audacious…



878
879
880
881
# File 'lib/ruote/engine.rb', line 878

def method_missing(method_name, *args)

  participant(method_name, *args)
end

Instance Method Details

- (Object) catchall(*args)



868
869
870
871
872
873
874
# File 'lib/ruote/engine.rb', line 868

def catchall(*args)

  klass = args.empty? ? Ruote::StorageParticipant : args.first
  options = args[1] || {}

  participant('.+', klass, options)
end

- (Object) participant(name, klass = nil, options = {}, &block)



863
864
865
866
# File 'lib/ruote/engine.rb', line 863

def participant(name, klass=nil, options={}, &block)

  @engine.register_participant(name, klass, options, &block)
end