Module: Namba::Config
Constant Summary collapse
- VALID_KEYS =
[ :username, :password, :locale ]
Instance Method Summary collapse
Instance Method Details
#configure {|_self| ... } ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/namba/config.rb', line 15 def configure yield self # Setting default configuraion options # if not provided self.tap do |s| s.username = "" if s.username.nil? s.password = "" if s.password.nil? s.locale = :kg if s.locale.nil? end raise ConfigurationError, "Available locales are only 'kg' and 'net'" unless [:kg, :net].include?(self.locale) end |
#options ⇒ Object
28 29 30 31 32 |
# File 'lib/namba/config.rb', line 28 def = {} VALID_KEYS.each {|k| [k] = send(k)} end |