Class: Gloo::App::RunningApp
- Inherits:
-
Object
- Object
- Gloo::App::RunningApp
- Defined in:
- lib/gloo/app/running_app.rb
Instance Attribute Summary collapse
-
#db_time ⇒ Object
readonly
Returns the value of attribute db_time.
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
-
#add_db_time(time) ⇒ Object
Add the given time to the db time.
-
#cache_db_client(obj, client) ⇒ Object
Cache the given DB client for the given object.
-
#db_client_for_obj(obj) ⇒ Object
Get the DB client for the given object.
-
#initialize(obj, engine) ⇒ RunningApp
constructor
Set up the running app for the given object.
-
#reset_db_time ⇒ Object
Reset the db time to zero.
-
#start ⇒ Object
Start the running app.
-
#stop ⇒ Object
The running app has been stopped.
Constructor Details
#initialize(obj, engine) ⇒ RunningApp
Set up the running app for the given object.
18 19 20 21 22 23 24 |
# File 'lib/gloo/app/running_app.rb', line 18 def initialize( obj, engine ) @engine = engine @log = @engine.log @obj = obj @db_clients = {} end |
Instance Attribute Details
#db_time ⇒ Object (readonly)
Returns the value of attribute db_time.
13 14 15 |
# File 'lib/gloo/app/running_app.rb', line 13 def db_time @db_time end |
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
13 14 15 |
# File 'lib/gloo/app/running_app.rb', line 13 def obj @obj end |
Instance Method Details
#add_db_time(time) ⇒ Object
Add the given time to the db time.
49 50 51 52 |
# File 'lib/gloo/app/running_app.rb', line 49 def add_db_time time @db_time = 0 unless @db_time @db_time += time end |
#cache_db_client(obj, client) ⇒ Object
Cache the given DB client for the given object.
69 70 71 |
# File 'lib/gloo/app/running_app.rb', line 69 def cache_db_client( obj, client ) @db_clients[ obj.pn ] = client end |
#db_client_for_obj(obj) ⇒ Object
Get the DB client for the given object.
76 77 78 |
# File 'lib/gloo/app/running_app.rb', line 76 def db_client_for_obj( obj ) return @db_clients[ obj.pn ] end |
#reset_db_time ⇒ Object
Reset the db time to zero
57 58 59 |
# File 'lib/gloo/app/running_app.rb', line 57 def reset_db_time @db_time = 0 end |
#start ⇒ Object
Start the running app.
28 29 30 31 |
# File 'lib/gloo/app/running_app.rb', line 28 def start obj.start @log.debug "running app started for #{@obj.pn}" end |
#stop ⇒ Object
The running app has been stopped.
36 37 38 39 |
# File 'lib/gloo/app/running_app.rb', line 36 def stop obj.stop @log.debug "running app stopped for #{@obj.pn}" end |