123456789_123456789_123456789_123456789_123456789_

Class: Timezone::Lookup::OptionSetter

Relationships & Source Files
Inherits: Object
Defined in: lib/timezone/lookup.rb

Overview

Responsible for collecting options in the DSL and creating lookup objects using those options.

Constant Summary

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(lookup) ⇒ OptionSetter

[ GitHub ]

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

def initialize(lookup)
  if lookup.is_a?(Symbol)
    lookup = LOOKUPS.fetch(lookup) do
      raise ::Timezone::Error::InvalidConfig, INVALID_LOOKUP
    end
  end

  @lookup = lookup

  @config = OpenStruct.new
end

Instance Attribute Details

#config (readonly)

[ GitHub ]

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

attr_reader :config

Instance Method Details

#make_lookup

[ GitHub ]

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

def make_lookup
  config.request_handler ||= ::Timezone::NetHTTPClient
  @lookup.new(config)
end