Class: LibSL::Client
- Inherits:
-
Object
- Object
- LibSL::Client
- Defined in:
- lib/client.rb
Instance Attribute Summary collapse
-
#agent_manager ⇒ Object
Returns the value of attribute agent_manager.
-
#event_manager ⇒ Object
Returns the value of attribute event_manager.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#network_manager ⇒ Object
Returns the value of attribute network_manager.
-
#search_manager ⇒ Object
Returns the value of attribute search_manager.
Instance Method Summary collapse
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #login ⇒ Object
- #run ⇒ Object
- #setup(firstname, lastname, password, start = 'last', grid = :agni) ⇒ Object
- #setup? ⇒ Boolean
- #stop ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
16 17 18 19 20 21 22 23 |
# File 'lib/client.rb', line 16 def initialize() @is_setup = false #@event_manager = EventManager.new self @network_manager = NetworkManager.new self @agent_manager = AgentManager.new self @search_manager = SearchManager.new self @logger = Logger.new end |
Instance Attribute Details
#agent_manager ⇒ Object
Returns the value of attribute agent_manager.
14 15 16 |
# File 'lib/client.rb', line 14 def agent_manager @agent_manager end |
#event_manager ⇒ Object
Returns the value of attribute event_manager.
14 15 16 |
# File 'lib/client.rb', line 14 def event_manager @event_manager end |
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/client.rb', line 14 def logger @logger end |
#network_manager ⇒ Object
Returns the value of attribute network_manager.
14 15 16 |
# File 'lib/client.rb', line 14 def network_manager @network_manager end |
#search_manager ⇒ Object
Returns the value of attribute search_manager.
14 15 16 |
# File 'lib/client.rb', line 14 def search_manager @search_manager end |
Instance Method Details
#login ⇒ Object
30 31 32 |
# File 'lib/client.rb', line 30 def login() @network_manager.login @firstname, @lastname, @password, @start_location, @grid end |
#run ⇒ Object
47 48 49 50 51 52 |
# File 'lib/client.rb', line 47 def run() login rescue LoginError => e puts "[ERROR] #{e.}" EventMachine::stop_event_loop() end |
#setup(firstname, lastname, password, start = 'last', grid = :agni) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/client.rb', line 34 def setup(firstname, lastname, password, start='last', grid=:agni) @firstname = firstname @lastname = lastname @password = password @start_location = start @grid = grid @is_setup = true end |
#setup? ⇒ Boolean
43 44 45 |
# File 'lib/client.rb', line 43 def setup?() @is_setup end |
#stop ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/client.rb', line 54 def stop() EventManager::fire_event(:stopping) @network_manager.logout # Wait for all sims to disconnect EventMachine::add_timer(5) { EventManager::fire_event(:stopped) EventMachine::stop_event_loop() } end |