Module: Berkshelf::API::GenericServer::ClassMethods
- Defined in:
- lib/berkshelf/api/generic_server.rb
Instance Method Summary collapse
-
#instance ⇒ Celluloid::Actor
Returns the currently running instance of the including Class.
-
#server_name(name = nil) ⇒ Symbol
Set the name that the actor will be registered as with the applicaiton.
-
#start(*args) ⇒ Object
Start the cache manager and add it to the application's registry.
-
#stop ⇒ Object
Stop the cache manager if it's running.
Instance Method Details
#instance ⇒ Celluloid::Actor
Returns the currently running instance of the including Class
14 15 16 17 18 19 |
# File 'lib/berkshelf/api/generic_server.rb', line 14 def instance unless Application[server_name] && Application[server_name].alive? raise NotStartedError, "#{server_name} not running" end Application[server_name] end |
#server_name(name = nil) ⇒ Symbol
Set the name that the actor will be registered as with the applicaiton
26 27 28 29 |
# File 'lib/berkshelf/api/generic_server.rb', line 26 def server_name(name = nil) return @server_name if name.nil? @server_name = name.to_sym end |
#start(*args) ⇒ Object
you probably do not want to manually start the cache manager unless you are testing the application. Start the entire application with Application.run
Start the cache manager and add it to the application's registry.
35 36 37 |
# File 'lib/berkshelf/api/generic_server.rb', line 35 def start(*args) Application[server_name] = new(*args) end |
#stop ⇒ Object
you probably don't want to manually stop the cache manager unless you are testing the application. Stop the entire application with Application.shutdown
Stop the cache manager if it's running.
43 44 45 46 47 |
# File 'lib/berkshelf/api/generic_server.rb', line 43 def stop unless actor = Application[server_name] actor.terminate end end |