123456789_123456789_123456789_123456789_123456789_

Module: Timezone::Lookup

Overview

Configure timezone lookups.

Constant Summary

Class Method Summary

Class Method Details

.config(lookup) {|an| ... } ⇒ #lookup

Configure a lookup object

Parameters:

  • lookup (:google, :geonames, :test)

    use a built-in lookup

  • lookup (Class)

    a custom lookup class

Yield Parameters:

  • an (OpenStruct)

    object on which to set configuration options

Returns:

  • (#lookup)

    the lookup object

[ GitHub ]

  
# File 'lib/timezone/lookup.rb', line 33

def config(lookup)
  options = OptionSetter.new(lookup)
  yield(options.config) if block_given?
  @lookup = options.make_lookup
end

.lookup ⇒ #lookup

Returns the lookup object

Returns:

  • (#lookup)

    the lookup object

Raises:

[ GitHub ]

  
# File 'lib/timezone/lookup.rb', line 21

def lookup
  @lookup || raise(::Timezone::Error::InvalidConfig, MISSING_LOOKUP)
end