lib/ruote/context.rb in ruote-2.1.10 vs lib/ruote/context.rb in ruote-2.1.11

- old
+ new

@@ -111,11 +111,11 @@ key = "s_#{key}" unless SERVICE_PREFIX.match(key) service = if klass - require(path) + require(path) if path aa = [ self ] aa << opts if opts @services[key] = Ruote.constantize(klass).new(*aa) @@ -123,10 +123,18 @@ @services[key] = path end self.class.class_eval %{ def #{key[2..-1]}; @services['#{key}']; end } + # + # This 'one-liner' will add an instance method to Context for this + # service. + # + # If the service key is 's_dishwasher', then the service will be + # available via Context#dishwasher. + # + # I.e. dishwasher = engine.context.dishwasher service end # Takes care of shutting down every service registered in this context. @@ -161,22 +169,24 @@ { 's_wfidgen' => [ 'ruote/id/mnemo_wfid_generator', 'Ruote::MnemoWfidGenerator' ], 's_parser' => [ 'ruote/parser', 'Ruote::Parser' ], 's_treechecker' => [ - 'ruote/util/treechecker', 'Ruote::TreeChecker' ], + 'ruote/svc/treechecker', 'Ruote::TreeChecker' ], 's_expmap' => [ - 'ruote/exp/expression_map', 'Ruote::ExpressionMap' ], + 'ruote/svc/expression_map', 'Ruote::ExpressionMap' ], 's_tracker' => [ - 'ruote/evt/tracker', 'Ruote::Tracker' ], + 'ruote/svc/tracker', 'Ruote::Tracker' ], 's_plist' => [ - 'ruote/part/participant_list', 'Ruote::ParticipantList' ], + 'ruote/svc/participant_list', 'Ruote::ParticipantList' ], 's_dispatch_pool' => [ - 'ruote/part/dispatch_pool', 'Ruote::DispatchPool' ], - 's_logger' => [ - 'ruote/log/wait_logger', 'Ruote::WaitLogger' ], + 'ruote/svc/dispatch_pool', 'Ruote::DispatchPool' ], + 's_dollar_sub' => [ + 'ruote/svc/dollar_sub', 'Ruote::DollarSubstitution' ], 's_error_handler' => [ - 'ruote/error_handler', 'Ruote::ErrorHandler' ] } + 'ruote/svc/error_handler', 'Ruote::ErrorHandler' ], + 's_logger' => [ + 'ruote/log/wait_logger', 'Ruote::WaitLogger' ] } end end end