Rubeuler 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -7,5 +7,7 @@
7
7
  0.0.4 - Add tests using minitest
8
8
 
9
9
  0.0.5 - Feature: Track other variables... the options `tracked: {foo: @foo}` would track a variable set as `@foo` in Rubeuler::Problem's `:answer` argument
10
- Improve on tests, improve timer by moving Benchmark closer to code being evaluated,
10
+ Improve on tests, improve timer by moving Benchmark closer to code being evaluated
11
+
12
+ 0.0.6 - Reverting the change to the Benchmark implementation from 0.0.5
11
13
 
data/README.md CHANGED
@@ -18,7 +18,20 @@ If the answer to problem one is 42, the code below should produce a successful r
18
18
  Rubeuler::Problem.new(number: 1, answer: "7*3*2").execute!
19
19
  ```
20
20
 
21
+ Extra options (just one right now):
22
+ ```ruby
23
+ answer = "@loop_count = 0; 1001.times do; @loop_count += 1; end; result = 42"
24
+
25
+ # Use :tracked option to track extra variables included in your algorithm
26
+ Rubeuler::Problem.new(number: 1, answer: answer, tracked: {loop_count: "@loop_count"}).execute!
27
+ => #<Rubeuler::Result:0x007fef81c221f8
28
+ @data={:solution=>42, :loop_count=>1001},
29
+ @runtime=0.0002689361572265625,
30
+ @success=true>
31
+ ```
32
+
21
33
  __NOTE__: Solutions (see Rubeuler::Solution) are not provided for you. Successfully solve some ProjectEuler problems to build your own list, then use Rubeuler to judge the quality of your solutions.
34
+ __NOTE__: The last expression in the `:answer` argument will be compared to solution predefined in `Rubeuler::Solution` for that problem number.
22
35
 
23
36
  ### Pull requests/issues
24
37
 
@@ -19,8 +19,7 @@ module Rubeuler
19
19
 
20
20
  private
21
21
  def timed_answer
22
- timer_endpoints = ["Benchmark.measure { @data =", "}.real"]
23
- instance_eval(timer_endpoints.join(@answer.gsub("\n",";")))
22
+ timer_endpoints = Benchmark.measure { @data = instance_eval(@answer.gsub("\n",";"))}.real
24
23
  end
25
24
 
26
25
  def solution
@@ -1,3 +1,3 @@
1
1
  module Rubeuler
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Rubeuler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: