Module: EarthTools
- Extended by:
- EarthTools
- Included in:
- EarthTools
- Defined in:
- lib/earth_tools.rb,
lib/earth_tools/cache.rb,
lib/earth_tools/version.rb,
lib/earth_tools/exceptions.rb,
lib/earth_tools/lookup/base.rb,
lib/earth_tools/result/base.rb,
lib/earth_tools/configuration.rb
Defined Under Namespace
Modules: Lookup, Result Classes: Cache, Configuration, ConfigurationError, Error, InvalidInputError, OverQueryLimitError, UnsupportedOperationError
Constant Summary collapse
- VERSION =
The gem version
"0.1.1"
Class Method Summary collapse
-
.configure(&block) ⇒ Object
This method can be used to change some functional aspects, like the cache client or the units of calculations.
Instance Method Summary collapse
-
#height(latitude, longitude) ⇒ EarthTools::Result::Height
Retrieve the land height for a given latitude and longitude.
-
#sunrise_sunset(latitude, longitude, month, day, timezone = 99, dst = false) ⇒ EarthTools::Result::SunriseSunset
Retrieve the sunrise & sunset values.
-
#time_zone(latitude, longitude) ⇒ Object
Retrieve for time zone based on latitude and longitude.
Class Method Details
.configure(&block) ⇒ Object
This method can be used to change some functional aspects, like the cache client or the units of calculations. See The singleton that maintains the configuration settings for plugin..
8 9 10 11 12 13 14 |
# File 'lib/earth_tools/configuration.rb', line 8 def self.configure(&block) if block_given? block.call(Configuration.instance) else Configuration.instance end end |
Instance Method Details
#height(latitude, longitude) ⇒ EarthTools::Result::Height
Retrieve the land height for a given latitude and longitude.
25 26 27 |
# File 'lib/earth_tools.rb', line 25 def height(latitude, longitude) get_lookup(:height).search(latitude, longitude) end |
#sunrise_sunset(latitude, longitude, month, day, timezone = 99, dst = false) ⇒ EarthTools::Result::SunriseSunset
Retrieve the sunrise & sunset values.
18 19 20 |
# File 'lib/earth_tools.rb', line 18 def sunrise_sunset(latitude, longitude, month, day, timezone = 99, dst = false) get_lookup(:sunrise_sunset).search(latitude, longitude, day, month, timezone, dst ? 1 : 0) end |
#time_zone(latitude, longitude) ⇒ Object
Retrieve for time zone based on latitude and longitude.
11 12 13 |
# File 'lib/earth_tools.rb', line 11 def time_zone(latitude, longitude) get_lookup(:time_zone).search(latitude, longitude) if valid_input?(latitude, longitude) end |