-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.rb
50 lines (41 loc) · 1.04 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
class AB
module Config
class <<self
def binary(binary=nil)
@binary = binary unless binary.nil?
@binary
end
def categories(categories=nil)
@categories = categories unless categories.nil?
@categories
end
def env(env=nil)
@env = env unless env.nil?
@env || ENV['RACK_ENV'] || ENV['RAILS_ENV'] || 'development'
end
def reset
@binary = @categories = @env = @root = @site = @url = @token = @yaml = nil
end
def root(root=nil)
@root = root unless root.nil?
@root
end
def site(site=nil)
@site = site unless site.nil?
@site
end
def url(url=nil)
@url = url unless url.nil?
@url
end
def token(token=nil)
@token = token unless token.nil?
@token
end
def yaml(yaml=nil)
@yaml = yaml unless yaml.nil?
@yaml || ("#{root}/config/a_b.yml" if root)
end
end
end
end