Class: Timezone::Configure
- Inherits:
-
Object
- Object
- Timezone::Configure
- Defined in:
- lib/timezone/configure.rb
Overview
Configuration class for the Timezone gem.
You’ll want to sign up for a geonames username at Geonames. Use the username to configure your application for latitude and longitude based timezone searches.
If you aren’t going to initialize timezone objects based on lat,lng then this configuration is not necessary.
Class Method Summary collapse
- .begin {|_self| ... } ⇒ Object
- .default_for_list ⇒ Object
- .default_for_list=(*list) ⇒ Object
-
.http_client ⇒ Object
The HTTP client that handles requests to geonames.
-
.http_client=(client) ⇒ Object
The HTTP client that handles requests to geonames.
- .order_list_by ⇒ Object
- .order_list_by=(order) ⇒ Object
-
.protocol ⇒ Sting
The Geonames API HTTP protocol.
-
.protocol=(protocol) ⇒ Object
The Geonames API HTTP protocol.
- .replace(what, with = Hash.new) ⇒ Object
- .replacements ⇒ Object
-
.url ⇒ Sting
The Geonames API URL.
-
.url=(url) ⇒ Object
The Geonames API URL.
- .username ⇒ Object
- .username=(username) ⇒ Object
Class Method Details
.begin {|_self| ... } ⇒ Object
78 79 80 |
# File 'lib/timezone/configure.rb', line 78 def self.begin yield self end |
.default_for_list ⇒ Object
91 92 93 |
# File 'lib/timezone/configure.rb', line 91 def self.default_for_list @@default_list ||= nil end |
.default_for_list=(*list) ⇒ Object
95 96 97 |
# File 'lib/timezone/configure.rb', line 95 def self.default_for_list=(*list) @@default_list = list.flatten! end |
.http_client ⇒ Object
The HTTP client that handles requests to geonames
57 58 59 |
# File 'lib/timezone/configure.rb', line 57 def self.http_client @@http_client ||= Timezone::NetHTTPClient end |
.http_client=(client) ⇒ Object
The HTTP client that handles requests to geonames
66 67 68 |
# File 'lib/timezone/configure.rb', line 66 def self.http_client=(client) @@http_client = client end |
.order_list_by ⇒ Object
99 100 101 |
# File 'lib/timezone/configure.rb', line 99 def self.order_list_by @@order_by ||= :utc_offset end |
.order_list_by=(order) ⇒ Object
103 104 105 |
# File 'lib/timezone/configure.rb', line 103 def self.order_list_by=(order) @@order_by = order end |
.protocol ⇒ Sting
The Geonames API HTTP protocol
49 50 51 |
# File 'lib/timezone/configure.rb', line 49 def self.protocol @protocol ||= 'http' end |
.protocol=(protocol) ⇒ Object
The Geonames API HTTP protocol
41 42 43 |
# File 'lib/timezone/configure.rb', line 41 def self.protocol=(protocol) @@protocol = protocol end |
.replace(what, with = Hash.new) ⇒ Object
82 83 84 85 |
# File 'lib/timezone/configure.rb', line 82 def self.replace(what, with = Hash.new) replacements # instantiate @@replacements @@replacements[what] = with[:with] end |
.replacements ⇒ Object
87 88 89 |
# File 'lib/timezone/configure.rb', line 87 def self.replacements @@replacements ||= {} end |
.url ⇒ Sting
The Geonames API URL
25 26 27 |
# File 'lib/timezone/configure.rb', line 25 def self.url @@url ||= 'api.geonames.org' end |
.url=(url) ⇒ Object
The Geonames API URL
33 34 35 |
# File 'lib/timezone/configure.rb', line 33 def self.url=(url) @@url = url end |
.username ⇒ Object
70 71 72 |
# File 'lib/timezone/configure.rb', line 70 def self.username @@username end |
.username=(username) ⇒ Object
74 75 76 |
# File 'lib/timezone/configure.rb', line 74 def self.username= username @@username = username end |