Class: Spyme::Model::Location
- Inherits:
-
Object
- Object
- Spyme::Model::Location
- Includes:
- ActiveModel::Model
- Defined in:
- lib/spyme/model.rb
Instance Attribute Summary collapse
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#latitude ⇒ Object
Returns the value of attribute latitude.
6 7 8 |
# File 'lib/spyme/model.rb', line 6 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
6 7 8 |
# File 'lib/spyme/model.rb', line 6 def longitude @longitude end |
Class Method Details
.from_session(session) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/spyme/model.rb', line 24 def from_session(session) latitude = session[:latitude] || '' longitude = session[:longitude] || '' self.new(latitude: latitude.to_f, longitude: longitude.to_f) end |
Instance Method Details
#coords ⇒ Object
19 20 21 |
# File 'lib/spyme/model.rb', line 19 def coords [latitude,longitude] end |
#to_hash ⇒ Object
15 16 17 |
# File 'lib/spyme/model.rb', line 15 def to_hash { latitude: latitude, longitude: longitude } end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/spyme/model.rb', line 11 def to_s "#{latitude}, #{longitude}" end |