Class: Forgery::Geo
- Inherits:
-
Forgery
- Object
- Forgery
- Forgery::Geo
- Defined in:
- lib/sixarm_ruby_fab/forgery/geo.rb
Overview
Generates random geographic information.
Class Method Summary collapse
-
.latitude ⇒ Object
Return a latitude in the range -90.0 to +90.0 as a float.
-
.latitude_degrees ⇒ Object
Return a latitude’s degrees component in the range -180 to +180 as an integer.
-
.latitude_direction ⇒ Object
Return a latitude’s direction component, either “N” (north) or “S” (south).
-
.latitude_minutes ⇒ Object
Return a latitude’s minutes component in the range 0 to 60 as an integer.
-
.latitude_seconds ⇒ Object
Return a latitude’s seconds component in the range 0 to 60 as an integer.
-
.longitude ⇒ Object
Return a longitude in the range -180.0 to +180.0 as a float.
-
.longitude_degrees ⇒ Object
Return a longitude’s degrees component in the range -180 to +180 as an integer.
-
.longitude_direction ⇒ Object
Return a longitude’s direction component, either “E” (east) or “W” (west).
-
.longitude_minutes ⇒ Object
Return a longitude’s minutes component in the range 0 to 60 as an integer.
-
.longitude_seconds ⇒ Object
Return a longitude’s seconds component in the range 0 to 60 as an integer.
Class Method Details
.latitude ⇒ Object
Return a latitude in the range -90.0 to +90.0 as a float.
7 8 9 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 7 def self.latitude rand * 180.0 - 90.0 end |
.latitude_degrees ⇒ Object
Return a latitude’s degrees component in the range -180 to +180 as an integer.
12 13 14 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 12 def self.latitude_degrees rand(360)-180 end |
.latitude_direction ⇒ Object
Return a latitude’s direction component, either “N” (north) or “S” (south)
27 28 29 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 27 def self.latitude_direction ['N','S'].sample end |
.latitude_minutes ⇒ Object
Return a latitude’s minutes component in the range 0 to 60 as an integer.
17 18 19 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 17 def self.latitude_minutes rand(60) end |
.latitude_seconds ⇒ Object
Return a latitude’s seconds component in the range 0 to 60 as an integer.
22 23 24 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 22 def self.latitude_seconds rand(60) end |
.longitude ⇒ Object
Return a longitude in the range -180.0 to +180.0 as a float.
32 33 34 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 32 def self.longitude rand * 360.0 - 180.0 end |
.longitude_degrees ⇒ Object
Return a longitude’s degrees component in the range -180 to +180 as an integer.
37 38 39 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 37 def self.longitude_degrees rand(360)-180 end |
.longitude_direction ⇒ Object
Return a longitude’s direction component, either “E” (east) or “W” (west)
52 53 54 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 52 def self.longitude_direction ["E","W"].sample end |
.longitude_minutes ⇒ Object
Return a longitude’s minutes component in the range 0 to 60 as an integer.
42 43 44 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 42 def self.longitude_minutes rand(60) end |
.longitude_seconds ⇒ Object
Return a longitude’s seconds component in the range 0 to 60 as an integer.
47 48 49 |
# File 'lib/sixarm_ruby_fab/forgery/geo.rb', line 47 def self.longitude_seconds rand(60) end |