Sha256: ec45fe55155649be99552a129d529e0db337f24a55e3d2838e869ad04e4ae523
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
# Generates random geographic information. class Forgery::Geo < Forgery # Return a latitude in the range -90.0 to +90.0 as a float. def self.latitude rand * 180.0 - 90.0 end # Return a latitude's degrees component in the range -180 to +180 as an integer. def self.latitude_degrees rand(360)-180 end # Return a latitude's minutes component in the range 0 to 60 as an integer. def self.latitude_minutes rand(60) end # Return a latitude's seconds component in the range 0 to 60 as an integer. def self.latitude_seconds rand(60) end # Return a latitude's direction component, either "N" (north) or "S" (south) def self.latitude_direction ['N','S'].sample end # Return a longitude in the range -180.0 to +180.0 as a float. def self.longitude rand * 360.0 - 180.0 end # Return a longitude's degrees component in the range -180 to +180 as an integer. def self.longitude_degrees rand(360)-180 end # Return a longitude's minutes component in the range 0 to 60 as an integer. def self.longitude_minutes rand(60) end # Return a longitude's seconds component in the range 0 to 60 as an integer. def self.longitude_seconds rand(60) end # Return a longitude's direction component, either "E" (east) or "W" (west) def self.longitude_direction ["E","W"].sample end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
forgery-0.8.1 | lib/forgery/forgery/geo.rb |
forgery-0.7.0 | lib/forgery/forgery/geo.rb |
forgery-0.6.0 | lib/forgery/forgery/geo.rb |