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

#initialize(engine) ⇒ ParticipantRegistrationProxy

Returns a new instance of ParticipantRegistrationProxy.



1011
1012
1013
1014
# File 'lib/ruote/engine.rb', line 1011

def initialize(engine)

  @engine = engine
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object

Maybe a bit audacious…



1035
1036
1037
1038
# File 'lib/ruote/engine.rb', line 1035

def method_missing(method_name, *args, &block)

  participant(method_name, *args, &block)
end

Instance Method Details

#catchall(*args) ⇒ Object Also known as: catch_all



1023
1024
1025
1026
1027
1028
1029
# File 'lib/ruote/engine.rb', line 1023

def catchall(*args)

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

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

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



1016
1017
1018
1019
1020
1021
# File 'lib/ruote/engine.rb', line 1016

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

  options.merge!(:override => false)

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