Class: Settlers::Application::Server
- Inherits:
-
Object
- Object
- Settlers::Application::Server
- Defined in:
- lib/settlers/application.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
-
#maximum_connections ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
-
#name ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
-
#password ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
-
#port ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
-
#robot_names ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
-
#startup_delay ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
-
#username ⇒ Object
readonly
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/settlers/application.rb', line 79 def initialize @name = "#{`hostname -s`.chomp}-#{`whoami`.chomp}" @host = 'localhost' @port = 8880 @startup_delay = 4 @maximum_connections = 12 @username = 'root' @password = '' @robot_names = %w(Leonardo Humperdink Elwood) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def host @host end |
#maximum_connections ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def maximum_connections @maximum_connections end |
#name ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def name @name end |
#password ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def password @password end |
#port ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def port @port end |
#robot_names ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def robot_names @robot_names end |
#startup_delay ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def startup_delay @startup_delay end |
#username ⇒ Object (readonly)
Maybe we can change these to attr_writer as we’d like to make them command-line configurable.
77 78 79 |
# File 'lib/settlers/application.rb', line 77 def username @username end |
Instance Method Details
#start ⇒ Object
90 91 92 93 94 95 |
# File 'lib/settlers/application.rb', line 90 def start announce serve sleep(startup_delay) start_robots end |