Rubeuler 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b6ce4946cdce698b52c47d9b924d941f9c9c1e8a
4
+ data.tar.gz: 2b065d1fc2131f42b3ded032327b22356cf0911c
5
+ SHA512:
6
+ metadata.gz: 5f8f851ea59a817d1bd6a274656cab654e7ae84748aa95dafe18538044d21572023861b55c6684d85c8c34bddcb6e012562a08d3360621e720231c6ffb29a5e7
7
+ data.tar.gz: 1b008887d7c400d6759ee4a4119db4f5dd459674adff2f565bf2f06f83e75dda4ceed50afd7b86c7ae122ddef062b949df9055e56307d08dd7bf9389325850e0
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ .ruby-version
9
+ .ruby-gemset
10
+
11
+ Gemfile.lock
12
+ /.bundle
13
+
14
+ *.sw?
15
+ .sw?
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.9.2
6
+ - jruby-19mode
7
+ - ruby-head
8
+ - jruby-head
9
+ script: bundle exec rake test
data/README.md CHANGED
@@ -1,12 +1,16 @@
1
- Rubeuler (sounds like rube-oiler)
1
+ Rubeuler
2
2
  ========
3
+ ![Leonhard Euler](http://upload.wikimedia.org/wikipedia/commons/c/cc/Euler%27s_signature.png)
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/Rubeuler.png)](http://badge.fury.io/rb/Rubeuler)[![Build Status](https://travis-ci.org/rthbound/rubeuler.png?branch=master)](https://travis-ci.org/rthbound/rubeuler) [![Coverage Status](https://coveralls.io/repos/rthbound/rubeuler/badge.png?branch=master)](https://coveralls.io/r/rthbound/rubeuler?branch=master)[![Code Climate](https://codeclimate.com/github/rthbound/rubeuler.png)](https://codeclimate.com/github/rthbound/rubeuler)
6
+
3
7
 
4
8
  For Rubyists who enjoy solving and optimizing [Project Euler](http://www.projecteuler.net) problems. It uses `Benchmark` so be sure to use this with Ruby >= 1.9.3
5
9
 
6
10
  Installation
7
11
  ------------
8
12
 
9
- Rubeuler is a Ruby gem, and can be installed using `gem install rubeuler`
13
+ Rubeuler is a Ruby gem, and can be installed using `gem install Rubeuler`
10
14
 
11
15
  Usage
12
16
  -----
@@ -20,7 +24,7 @@ Rubeuler::Problem.new(number: 1, answer: "7*3*2").execute!
20
24
 
21
25
  Extra options (just one right now):
22
26
  ```ruby
23
- answer = "@loop_count = 0; 1001.times do; @loop_count += 1; end; result = 42"
27
+ answer = "@loop_count = 0; 1001.times do; @loop_count += 1; end; result = 42"
24
28
 
25
29
  # Use :tracked option to track extra variables included in your algorithm
26
30
  Rubeuler::Problem.new(number: 1, answer: answer, tracked: {loop_count: "@loop_count"}).execute!
@@ -35,4 +39,4 @@ __NOTE__: The last expression in the `:answer` argument will be compared to solu
35
39
 
36
40
  ### Pull requests/issues
37
41
 
38
- Please submit any useful pull requests through GitHub. I expect bugs, please report them with the issue tracker! Thanks.
42
+ Please submit any pull requests through GitHub. Please report any problems with the issue tracker! Thanks.
@@ -11,20 +11,18 @@ module Rubeuler
11
11
 
12
12
  raise TypeError, ':answer should be a string' unless @answer.is_a?(String)
13
13
  raise TypeError, ':number should be an integer' unless @number.is_a?(Fixnum)
14
-
15
-
16
14
  end
17
15
 
18
16
  def execute!
19
17
  time = timed_answer
20
18
  true_or_false = @data == solution ? true : false
21
19
 
22
- return PayDirt::Result.new(success: true_or_false, problem: @number, data: data, runtime: time)
20
+ return PayDirt::Result.new(success: true, problem: @number, data: data)
23
21
  end
24
22
 
25
23
  private
26
24
  def timed_answer
27
- timer_endpoints = Benchmark.measure { @data = instance_eval(@answer.gsub("\n",";"))}.real
25
+ @benchmark = Benchmark.measure { @data = instance_eval(@answer.gsub("\n",";"))}.real
28
26
  end
29
27
 
30
28
  def solution
@@ -33,8 +31,10 @@ module Rubeuler
33
31
 
34
32
  def data
35
33
  result_data = {
36
- solution: @data
34
+ solution: @data,
35
+ benchmark: @benchmark
37
36
  }
37
+
38
38
  @tracked.each { |k,v| result_data.merge!({ k => instance_eval(v.to_s) }) } if @tracked
39
39
 
40
40
  result_data
@@ -1,3 +1,3 @@
1
1
  module Rubeuler
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/lib/rubeuler.rb CHANGED
@@ -1,5 +1,5 @@
1
+ require "pay_dirt/use_case"
2
+ require "pay_dirt/result"
1
3
  require "rubeuler/version"
2
4
  require "rubeuler/solution"
3
5
  require "rubeuler/problem"
4
- require "pay_dirt/use_case"
5
- require "pay_dirt/result"
data/rubeuler.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency "minitest"
22
22
  s.add_development_dependency "rake"
23
23
  s.add_development_dependency "pry"
24
+ s.add_development_dependency "coveralls"
24
25
  end
@@ -1,5 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
1
3
  # Testing frameworks
2
- require "minitest/spec"
3
4
  require "minitest/autorun"
4
5
  require "pay_dirt/use_case"
5
6
  require "pay_dirt/result"
metadata CHANGED
@@ -1,87 +1,94 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Rubeuler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ version: 0.1.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tad Hosford
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-04-29 00:00:00.000000000 Z
11
+ date: 2013-06-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: pay_dirt
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: minitest
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: pry
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
- description: ! ' For Rubyists who love ProjectEuler.net '
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: ' For Rubyists who love ProjectEuler.net '
79
84
  email:
80
85
  - tad.hosford@gmail.com
81
86
  executables: []
82
87
  extensions: []
83
88
  extra_rdoc_files: []
84
89
  files:
90
+ - .gitignore
91
+ - .travis.yml
85
92
  - CHANGELOG.md
86
93
  - Gemfile
87
94
  - README.md
@@ -96,33 +103,26 @@ files:
96
103
  - test/rubeuler/solution_test.rb
97
104
  homepage: http://github.com/rthbound/rubeuler
98
105
  licenses: []
106
+ metadata: {}
99
107
  post_install_message:
100
108
  rdoc_options: []
101
109
  require_paths:
102
110
  - lib
103
111
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
112
  requirements:
106
- - - ! '>='
113
+ - - '>='
107
114
  - !ruby/object:Gem::Version
108
115
  version: '0'
109
- segments:
110
- - 0
111
- hash: 384433139
112
116
  required_rubygems_version: !ruby/object:Gem::Requirement
113
- none: false
114
117
  requirements:
115
- - - ! '>='
118
+ - - '>='
116
119
  - !ruby/object:Gem::Version
117
120
  version: '0'
118
- segments:
119
- - 0
120
- hash: 384433139
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 1.8.25
123
+ rubygems_version: 2.0.3
124
124
  signing_key:
125
- specification_version: 3
125
+ specification_version: 4
126
126
  summary: Evaluates whether a block produces a predefined response. Returns diagnostics
127
127
  if the block's return value was expected.
128
128
  test_files: []