vanity 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +3 -0
- data/lib/vanity/experiment/base.rb +6 -5
- data/lib/vanity/metric.rb +6 -4
- data/vanity.gemspec +1 -1
- metadata +2 -2
data/CHANGELOG
CHANGED
@@ -10,16 +10,17 @@ module Vanity
|
|
10
10
|
# end
|
11
11
|
module Definition
|
12
12
|
|
13
|
+
attr_reader :playground
|
14
|
+
|
13
15
|
# Defines a new experiment, given the experiment's name, type and
|
14
16
|
# definition block.
|
15
17
|
def define(name, type, options = nil, &block)
|
16
|
-
options
|
17
|
-
@playground.define(name, type, options, &block)
|
18
|
+
playground.define(name, type, options || {}, &block)
|
18
19
|
end
|
19
20
|
|
20
|
-
def
|
21
|
+
def binding_with(playground)
|
21
22
|
@playground = playground
|
22
|
-
|
23
|
+
binding
|
23
24
|
end
|
24
25
|
|
25
26
|
end
|
@@ -44,7 +45,7 @@ module Vanity
|
|
44
45
|
context = Object.new
|
45
46
|
context.instance_eval do
|
46
47
|
extend Definition
|
47
|
-
experiment = eval(source, context.
|
48
|
+
experiment = eval(source, context.binding_with(playground), fn)
|
48
49
|
fail NameError.new("Expected #{fn} to define experiment #{id}", id) unless experiment.id == id
|
49
50
|
experiment
|
50
51
|
end
|
data/lib/vanity/metric.rb
CHANGED
@@ -21,16 +21,18 @@ module Vanity
|
|
21
21
|
# end
|
22
22
|
module Definition
|
23
23
|
|
24
|
+
attr_reader :playground
|
25
|
+
|
24
26
|
# Defines a new metric, using the class Vanity::Metric.
|
25
27
|
def metric(name, &block)
|
26
|
-
metric = Metric.new(
|
28
|
+
metric = Metric.new(playground, name.to_s, name.to_s.downcase.gsub(/\W/, "_"))
|
27
29
|
metric.instance_eval &block
|
28
30
|
metric
|
29
31
|
end
|
30
32
|
|
31
|
-
def
|
33
|
+
def binding_with(playground)
|
32
34
|
@playground = playground
|
33
|
-
|
35
|
+
binding
|
34
36
|
end
|
35
37
|
|
36
38
|
end
|
@@ -97,7 +99,7 @@ module Vanity
|
|
97
99
|
context = Object.new
|
98
100
|
context.instance_eval do
|
99
101
|
extend Definition
|
100
|
-
metric = eval(source, context.
|
102
|
+
metric = eval(source, context.binding_with(playground), fn)
|
101
103
|
fail NameError.new("Expected #{fn} to define metric #{id}", id) unless metric.name.downcase.gsub(/\W+/, '_').to_sym == id
|
102
104
|
metric
|
103
105
|
end
|
data/vanity.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vanity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Assaf Arkin
|
@@ -91,7 +91,7 @@ licenses: []
|
|
91
91
|
post_install_message: To get started run vanity --help
|
92
92
|
rdoc_options:
|
93
93
|
- --title
|
94
|
-
- Vanity 1.1.
|
94
|
+
- Vanity 1.1.1
|
95
95
|
- --main
|
96
96
|
- README.rdoc
|
97
97
|
- --webcvs
|