Class: Unveil::App
- Inherits:
-
Object
show all
- Defined in:
- lib/unveil/app.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
44
45
46
47
48
49
50
|
# File 'lib/unveil/app.rb', line 44
def method_missing(method, *args, &block)
if attributes.has_key?(method.to_s)
attributes(*args)[method.to_s]
else
super
end
end
|
Instance Method Details
#attributes(reload = false) ⇒ Object
3
4
5
6
|
# File 'lib/unveil/app.rb', line 3
def attributes(reload = false)
@attributes = nil if reload
@attributes ||= JSON.parse(Unveil.get("").body)
end
|
#feature_names(reload = false) ⇒ Object
12
13
14
|
# File 'lib/unveil/app.rb', line 12
def feature_names(reload = false)
features(reload).collect(&:name)
end
|
#features(reload = false) ⇒ Object
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
|
# File 'lib/unveil/app.rb', line 16
def features(reload = false)
@features = nil if reload
unless @features
@features = attributes(reload)['features']
if Unveil.scan_for_features?
implemented_features.each do |name, paths|
if @features.collect { |f| f['name'] }.include?(name)
feature = @features.detect { |f| f['name'] == name }
feature['paths'] = paths
else
implemented_feature = {
'name' => name,
'groups' => [],
'percentage' => nil,
'user_count' => 0,
'paths' => paths
}
@features << implemented_feature
end
end
end
end
@features.collect { |f| Unveil::Feature.new(f) }.sort_by(&:name)
end
|
#groups(reload = false) ⇒ Object
8
9
10
|
# File 'lib/unveil/app.rb', line 8
def groups(reload = false)
attributes(reload)['groups']
end
|