Class: Timezone::Configure
- Inherits:
-
Object
- Object
- Timezone::Configure
- Defined in:
- lib/timezone/configure.rb
Overview
Configuration class for the Timezone gem.
Timezone::Configure.begin do |c| ... end
c.username = username - the geonames username you use to access the geonames timezone API.
Signup for a geonames username at www.geonames.org/login. Use that username to configure your application for latitude and longitude based timezone searches. If you aren’t going to initialize timezone objects based on latitude and longitude then this configuration is not necessary.
Class Method Summary collapse
- .begin {|_self| ... } ⇒ Object
- .default_for_list ⇒ Object
- .default_for_list=(*list) ⇒ Object
- .order_list_by ⇒ Object
- .order_list_by=(order) ⇒ Object
- .replace(what, with = Hash.new) ⇒ Object
- .replacements ⇒ Object
- .url ⇒ Object
- .url=(url) ⇒ Object
- .username ⇒ Object
- .username=(username) ⇒ Object
Class Method Details
.begin {|_self| ... } ⇒ Object
28 29 30 |
# File 'lib/timezone/configure.rb', line 28 def self.begin yield self end |
.default_for_list ⇒ Object
41 42 43 |
# File 'lib/timezone/configure.rb', line 41 def self.default_for_list @@default_list ||= nil end |
.default_for_list=(*list) ⇒ Object
45 46 47 |
# File 'lib/timezone/configure.rb', line 45 def self.default_for_list=(*list) @@default_list = list.flatten! end |
.order_list_by ⇒ Object
49 50 51 |
# File 'lib/timezone/configure.rb', line 49 def self.order_list_by @@order_by ||= :utc_offset end |
.order_list_by=(order) ⇒ Object
53 54 55 |
# File 'lib/timezone/configure.rb', line 53 def self.order_list_by=(order) @@order_by = order end |
.replace(what, with = Hash.new) ⇒ Object
32 33 34 35 |
# File 'lib/timezone/configure.rb', line 32 def self.replace(what, with = Hash.new) replacements # instantiate @@replacements @@replacements[what] = with[:with] end |
.replacements ⇒ Object
37 38 39 |
# File 'lib/timezone/configure.rb', line 37 def self.replacements @@replacements ||= {} end |
.url ⇒ Object
12 13 14 |
# File 'lib/timezone/configure.rb', line 12 def self.url @@url ||= 'api.geonames.org' end |
.url=(url) ⇒ Object
16 17 18 |
# File 'lib/timezone/configure.rb', line 16 def self.url= url @@url = url end |
.username ⇒ Object
20 21 22 |
# File 'lib/timezone/configure.rb', line 20 def self.username @@username end |
.username=(username) ⇒ Object
24 25 26 |
# File 'lib/timezone/configure.rb', line 24 def self.username= username @@username = username end |