Module: TradeHill::Configuration
- Included in:
- TradeHill
- Defined in:
- lib/tradehill/configuration.rb
Constant Summary
- VALID_OPTIONS_KEYS =
An array of valid keys in the options hash when configuring a TradeHill::Client
[ :currency, :name, :pass, :version, ]
- DEFAULT_CURRENCY =
"USD".freeze
- DEFAULT_VERSION =
"1".freeze
Class Method Summary (collapse)
-
+ (Object) extended(base)
When this module is extended, set all configuration options to their default values.
Instance Method Summary (collapse)
-
- (Object) configure {|_self| ... }
Convenience method to allow configuration options to be set in a block.
-
- (Object) options
Create a hash of options and their values.
-
- (Object) reset
Reset all configuration options to defaults.
Class Method Details
+ (Object) extended(base)
When this module is extended, set all configuration options to their default values
20 21 22 |
# File 'lib/tradehill/configuration.rb', line 20 def self.extended(base) base.reset end |
Instance Method Details
- (Object) configure {|_self| ... }
Convenience method to allow configuration options to be set in a block
25 26 27 |
# File 'lib/tradehill/configuration.rb', line 25 def configure yield self end |
- (Object) options
Create a hash of options and their values
30 31 32 33 34 |
# File 'lib/tradehill/configuration.rb', line 30 def = {} VALID_OPTIONS_KEYS.each{|k| [k] = send(k)} end |
- (Object) reset
Reset all configuration options to defaults
37 38 39 40 41 42 43 |
# File 'lib/tradehill/configuration.rb', line 37 def reset self.currency = DEFAULT_CURRENCY self.name = nil self.pass = nil self.version = DEFAULT_VERSION self end |