-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.rb
37 lines (32 loc) · 970 Bytes
/
config.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module BigML
module Util
module Config
# The endpoint that will be used to connect if none is set
BIGML_ENDPOINT = "https://bigml.io/andromeda"
# The username if none is set
DEFAULT_BIGML_USERNAME = nil
# The api key if none is set
DEFAULT_BIGML_API_KEY = nil
# An array of valid keys in the options hash when configuring a {BigML::Client}
VALID_OPTIONS_KEYS = [:username, :api_key]
attr_accessor *VALID_OPTIONS_KEYS
# When this module is extended, set all configuration options to their default values
def self.extended(base)
base.reset
end
def configure
yield self
self
end
def options
options = {}
VALID_OPTIONS_KEYS.each{ |k| options[k] = send(k) }
options
end
def reset
self.username = DEFAULT_BIGML_USERNAME
self.api_key = DEFAULT_BIGML_API_KEY
end
end
end
end