Class: Ruote::ParticipantRegistrationProxy
- Inherits:
-
BlankSlate
- Object
- BlankSlate
- Ruote::ParticipantRegistrationProxy
- Defined in:
- lib/ruote/dashboard.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
- #_flush ⇒ Object
- #catchall(*args) ⇒ Object (also: #catch_all)
-
#initialize(dashboard, clear) ⇒ ParticipantRegistrationProxy
constructor
A new instance of ParticipantRegistrationProxy.
-
#method_missing(method_name, *args, &block) ⇒ Object
Maybe a bit audacious…
- #participant(name, klass = nil, options = {}, &block) ⇒ Object
Constructor Details
#initialize(dashboard, clear) ⇒ ParticipantRegistrationProxy
Returns a new instance of ParticipantRegistrationProxy.
1174 1175 1176 1177 1178 1179 1180 1181 |
# File 'lib/ruote/dashboard.rb', line 1174 def initialize(dashboard, clear) @dashboard = dashboard @dashboard.context.plist.clear if clear @list = clear ? [] : nil 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…
1209 1210 1211 1212 |
# File 'lib/ruote/dashboard.rb', line 1209 def method_missing(method_name, *args, &block) participant(method_name, *args, &block) end |
Instance Method Details
#_flush ⇒ Object
1214 1215 1216 1217 |
# File 'lib/ruote/dashboard.rb', line 1214 def _flush @dashboard.participant_list = @list if @list end |
#catchall(*args) ⇒ Object Also known as: catch_all
1197 1198 1199 1200 1201 1202 1203 |
# File 'lib/ruote/dashboard.rb', line 1197 def catchall(*args) klass = args.empty? ? Ruote::StorageParticipant : args.first = args[1] || {} participant('.+', klass, ) end |
#participant(name, klass = nil, options = {}, &block) ⇒ Object
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 |
# File 'lib/ruote/dashboard.rb', line 1183 def participant(name, klass=nil, ={}, &block) if @list @list << @dashboard.context.plist.to_entry(name, klass, , block) else @dashboard.register_participant( name, klass, .merge!(:override => false), &block) end end |