Class: CfSim::Portal
- Inherits:
-
Object
- Object
- CfSim::Portal
- Defined in:
- lib/cf_sim/portal.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name, latitude, longitude) ⇒ Portal
constructor
A new instance of Portal.
- #to_s ⇒ Object
Constructor Details
#initialize(name, latitude, longitude) ⇒ Portal
Returns a new instance of Portal.
4 5 6 7 8 |
# File 'lib/cf_sim/portal.rb', line 4 def initialize(name, latitude, longitude) @name = name @latitude = latitude @longitude = longitude end |
Instance Attribute Details
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
2 3 4 |
# File 'lib/cf_sim/portal.rb', line 2 def latitude @latitude end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
2 3 4 |
# File 'lib/cf_sim/portal.rb', line 2 def longitude @longitude end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
2 3 4 |
# File 'lib/cf_sim/portal.rb', line 2 def name @name end |
Instance Method Details
#==(other) ⇒ Object
10 11 12 |
# File 'lib/cf_sim/portal.rb', line 10 def ==(other) eql?(other) end |
#eql?(other) ⇒ Boolean
14 15 16 |
# File 'lib/cf_sim/portal.rb', line 14 def eql?(other) @name == other.name && @latitude == other.latitude && @longitude == other.longitude end |
#hash ⇒ Object
18 19 20 |
# File 'lib/cf_sim/portal.rb', line 18 def hash @name.hash + @latitude + @longitude end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/cf_sim/portal.rb', line 22 def to_s "#{name}(#{latitude}, #{longitude})" end |