Method: Timezone.lookup

Defined in:
lib/timezone.rb

.lookup(lat, long, default = :__block) {|name| ... } ⇒ Timezone::Zone, Object

Lookup a timezone name by (lat, long) and then fetch the timezone object.

Parameters:

  • lat (Double)

    the latitude coordinate

  • long (Double)

    the longitude coordinate

  • default (defaults to: :__block)

    an optional object to return if the remote lookup succeeds but the timezone is not found

Yields:

  • the block to run if the remote lookup succeeds and the timezone is not found

Yield Parameters:

  • name (String)

    the timezone name if the remote lookup succeeds and the timezone is not found

Returns:

  • (Timezone::Zone)

    if the remote lookup succeeds and the timezone is found

  • (Object)

    if the remote lookup succeeds, the timezone is not found, and a default value or block has been provided

Raises:



76
77
78
# File 'lib/timezone.rb', line 76

def self.lookup(lat, long, default = :__block, &block)
  fetch(::Timezone::Lookup.lookup.lookup(lat, long), default, &block)
end