Module: Timepad::Config
- Included in:
- Timepad
- Defined in:
- lib/timepad/config.rb
Constant Summary collapse
- DEFAULT_ENDPOINT =
'http://timepad.ru/api/'
- DEFAULT_ID =
nil
- DEFAULT_KEY =
nil
- VALID_OPTIONS_KEYS =
[ :id, :key, :endpoint ]
Class Method Summary collapse
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#options ⇒ Hash
Create a hash of options and their values.
- #reset ⇒ Object
Class Method Details
.extended(base) ⇒ Object
18 19 20 |
# File 'lib/timepad/config.rb', line 18 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
22 23 24 25 |
# File 'lib/timepad/config.rb', line 22 def configure yield self self end |
#options ⇒ Hash
Create a hash of options and their values
30 31 32 33 34 |
# File 'lib/timepad/config.rb', line 30 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
#reset ⇒ Object
36 37 38 39 40 41 |
# File 'lib/timepad/config.rb', line 36 def reset self.id = DEFAULT_ID self.key = DEFAULT_KEY self.endpoint = DEFAULT_ENDPOINT self end |