Class: City
Overview
Copyright © 2011 Jesse Sielaff
Instance Method Summary collapse
-
#connected?(city) ⇒ Boolean
Returns true if the two Cities are connected by a single direct Route, false otherwise.
-
#connected_cities ⇒ Object
Returns an Array of Cities connected to the City by a single direct Route.
-
#name ⇒ Object
Returns the name of the City as a Symbol.
-
#routes ⇒ Object
Returns an Array of Routes leading into and out of the City.
-
#unclaimed_routes ⇒ Object
Returns an Array of Routes leading into and out of the City that are not claimed by any Player.
Methods inherited from Entity
Constructor Details
This class inherits a constructor from Entity
Instance Method Details
#connected?(city) ⇒ Boolean
Returns true if the two Cities are connected by a single direct Route, false otherwise.
10 11 12 |
# File 'lib/ttr/entities/city.rb', line 10 def connected? (city) @obj.connected?(City.object(city)) end |
#connected_cities ⇒ Object
Returns an Array of Cities connected to the City by a single direct Route.
16 17 18 |
# File 'lib/ttr/entities/city.rb', line 16 def connected_cities City.entities(@obj.connected_city_objs) end |
#name ⇒ Object
Returns the name of the City as a Symbol.
22 23 24 |
# File 'lib/ttr/entities/city.rb', line 22 def name @obj.name end |
#routes ⇒ Object
Returns an Array of Routes leading into and out of the City.
28 29 30 |
# File 'lib/ttr/entities/city.rb', line 28 def routes Route.entities(@obj.route_objs) end |
#unclaimed_routes ⇒ Object
Returns an Array of Routes leading into and out of the City that are not claimed by any Player.
35 36 37 |
# File 'lib/ttr/entities/city.rb', line 35 def unclaimed_routes Route.entities(@obj.route_objs.reject {|obj| obj.player_obj }) end |