Class: CfSim::PortalMap
- Inherits:
-
Object
- Object
- CfSim::PortalMap
- Defined in:
- lib/cf_sim/portal_map.rb
Instance Attribute Summary collapse
-
#points ⇒ Object
readonly
Returns the value of attribute points.
-
#portals ⇒ Object
readonly
Returns the value of attribute portals.
Instance Method Summary collapse
- #find_point(portal) ⇒ Object
- #find_portal(point) ⇒ Object
-
#initialize(*portals) ⇒ PortalMap
constructor
A new instance of PortalMap.
Constructor Details
#initialize(*portals) ⇒ PortalMap
Returns a new instance of PortalMap.
9 10 11 12 13 14 15 |
# File 'lib/cf_sim/portal_map.rb', line 9 def initialize(*portals) @portals = portals.flatten.dup.freeze @cordination_system = CfSim::CordinationSystem.new(@portals.first.latitude, @portals.first.longitude) @portal_map = {} @point_map = {} convert_to_points end |
Instance Attribute Details
#points ⇒ Object (readonly)
Returns the value of attribute points.
7 8 9 |
# File 'lib/cf_sim/portal_map.rb', line 7 def points @points end |
#portals ⇒ Object (readonly)
Returns the value of attribute portals.
7 8 9 |
# File 'lib/cf_sim/portal_map.rb', line 7 def portals @portals end |
Instance Method Details
#find_point(portal) ⇒ Object
21 22 23 |
# File 'lib/cf_sim/portal_map.rb', line 21 def find_point(portal) @point_map[portal] end |
#find_portal(point) ⇒ Object
17 18 19 |
# File 'lib/cf_sim/portal_map.rb', line 17 def find_portal(point) @portal_map[point] end |