euler 1.0.7 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/LICENSE +20 -0
- data/README.rdoc +18 -0
- data/Rakefile +52 -9
- data/VERSION +1 -0
- data/lib/euler.rb +2 -2
- data/test/tc_integer_methods.rb +1 -1
- metadata +22 -48
- data.tar.gz.sig +0 -2
- data/History.txt +0 -22
- data/Manifest.txt +0 -8
- metadata.gz.sig +0 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Mike Skalnik
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
= euler
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but
|
13
|
+
bump version in a commit by itself I can ignore when I pull)
|
14
|
+
* Send me a pull request. Bonus points for topic branches.
|
15
|
+
|
16
|
+
== Copyright
|
17
|
+
|
18
|
+
Copyright (c) 2009 Mike Skalnik. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,11 +1,54 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require '
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "euler"
|
8
|
+
gem.summary = %Q{A small library to help solve Projet Euler problems.}
|
9
|
+
gem.description = %Q{A gem that provides a small library to help in removing the repetativeness of solving Project Euler problems.}
|
10
|
+
gem.email = "mike.skalnik@gmail.com"
|
11
|
+
gem.homepage = "http://github.com/skalnik/euler"
|
12
|
+
gem.authors = ["Mike Skalnik"]
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rake/testtask'
|
19
|
+
Rake::TestTask.new(:test) do |test|
|
20
|
+
test.libs << 'lib' << 'test'
|
21
|
+
test.pattern = 'test/tc_*.rb'
|
22
|
+
test.verbose = true
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'rcov/rcovtask'
|
27
|
+
Rcov::RcovTask.new do |test|
|
28
|
+
test.libs << 'test'
|
29
|
+
test.pattern = 'test/**/*_test.rb'
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :rcov do
|
34
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
task :test => :check_dependencies
|
39
|
+
|
40
|
+
task :default => :test
|
41
|
+
|
42
|
+
require 'rake/rdoctask'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
if File.exist?('VERSION')
|
45
|
+
version = File.read('VERSION')
|
46
|
+
else
|
47
|
+
version = ""
|
48
|
+
end
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "euler #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
11
54
|
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.8
|
data/lib/euler.rb
CHANGED
@@ -8,7 +8,7 @@ module Euler
|
|
8
8
|
# Returns +self+!
|
9
9
|
# 5.factorial # => 120
|
10
10
|
def factorial
|
11
|
-
return
|
11
|
+
return 1 if self < 1
|
12
12
|
(2..self).inject(1) { |value, n| value * n }
|
13
13
|
end
|
14
14
|
|
@@ -177,4 +177,4 @@ module Euler
|
|
177
177
|
end
|
178
178
|
|
179
179
|
# Just adds Euler::IntegerMethods to the Integer class.
|
180
|
-
Integer.send :include, Euler::IntegerMethods
|
180
|
+
Integer.send :include, Euler::IntegerMethods
|
data/test/tc_integer_methods.rb
CHANGED
@@ -4,7 +4,7 @@ require "euler"
|
|
4
4
|
|
5
5
|
class TestIntegerMethods < Test::Unit::TestCase
|
6
6
|
def test_factorial
|
7
|
-
assert_equal(
|
7
|
+
assert_equal(1, 0.factorial, "0! == 1")
|
8
8
|
assert_equal(1, 1.factorial, "1! == 1")
|
9
9
|
assert_equal(120, 5.factorial, "5! == 120")
|
10
10
|
end
|
metadata
CHANGED
@@ -1,74 +1,46 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: euler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Skalnik
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
- |
|
12
|
-
-----BEGIN CERTIFICATE-----
|
13
|
-
MIIDOjCCAiKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBDMRUwEwYDVQQDDAxtaWtl
|
14
|
-
LnNrYWxuaWsxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkW
|
15
|
-
A2NvbTAeFw0wODA4MjYxODM5NTRaFw0wOTA4MjYxODM5NTRaMEMxFTATBgNVBAMM
|
16
|
-
DG1pa2Uuc2thbG5pazEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPy
|
17
|
-
LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwkBmKJIP
|
18
|
-
cVdR+FW7HxjEoayle8x+xFaXLJa4XaXjlRp09fJirHWbxi2eFvlFd70Z/ZHSvoa2
|
19
|
-
D9QItWmR90fAgT6WGk9z7mmc7cPwGMlHDTG3NoBO18uswYflc6oVMKgL6WV8LBfm
|
20
|
-
DYpVRKd20/PYGW/0a4bOghun46cbD9Uj+FcPtoRGSpEHnh8x8AS+JXUiq285xVAy
|
21
|
-
byRQzn/6/QVneLmkV07ITXtTaZgluroxIQGS6ELeSNuNLTS/rM+ZSxI1DpUm7P8m
|
22
|
-
n0xIeUvRnYnyOR/9g/7CUEFHSxMHh8qJ9fQB80p6mU00EKP932fuN3dkYdOdIn6D
|
23
|
-
kwd/rl7xKqGbIwIDAQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
|
24
|
-
HQ4EFgQUsKiLtNr7FqXSFnGiY67qJaQE9TQwDQYJKoZIhvcNAQEFBQADggEBAAZY
|
25
|
-
1qDlE4P0GljxgQ92eeCL+NczVonyleOpr4Tr16xqOQ9s9WKLgc5AECzfylX/Kq13
|
26
|
-
fds01mFgwSs2VyFRYgUIaGwpWVe6U5j+wvPqqwcj53NL7859RN5zuRt39TMccqAq
|
27
|
-
fEI+cuYH8jO5EN7CgznLYS+vHglvps3Xb1RpNmLZkeVlYdvuWxG+NB1jOVhfu0Ca
|
28
|
-
B5H8r4SyOphCTKpS98Tow/xlKdIxMIBzPlE5v4JcQ/C9md15eou++mU1sasjqtBu
|
29
|
-
F7c6BF4ofyU8+mL+RY2ih85FC0kMlM1Yhs/ZdEIjai3I6KYQtJJNVK/7x5vJAvLo
|
30
|
-
jjVX87g40jCN9NIGt+c=
|
31
|
-
-----END CERTIFICATE-----
|
10
|
+
cert_chain: []
|
32
11
|
|
33
|
-
date:
|
12
|
+
date: 2009-10-11 00:00:00 -04:00
|
34
13
|
default_executable:
|
35
|
-
dependencies:
|
36
|
-
|
37
|
-
name: hoe
|
38
|
-
type: :development
|
39
|
-
version_requirement:
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
version: 1.8.2
|
45
|
-
version:
|
14
|
+
dependencies: []
|
15
|
+
|
46
16
|
description: A gem that provides a small library to help in removing the repetativeness of solving Project Euler problems.
|
47
|
-
email:
|
48
|
-
- mike.skalnik@gmail.com
|
17
|
+
email: mike.skalnik@gmail.com
|
49
18
|
executables: []
|
50
19
|
|
51
20
|
extensions: []
|
52
21
|
|
53
22
|
extra_rdoc_files:
|
54
|
-
-
|
55
|
-
-
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
56
25
|
- README.txt
|
57
26
|
files:
|
58
|
-
-
|
59
|
-
-
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
60
30
|
- README.txt
|
61
31
|
- Rakefile
|
32
|
+
- VERSION
|
62
33
|
- lib/euler.rb
|
63
|
-
- test/test_euler.rb
|
64
34
|
- test/tc_integer_methods.rb
|
65
35
|
- test/tc_module.rb
|
36
|
+
- test/test_euler.rb
|
66
37
|
has_rdoc: true
|
67
|
-
homepage: http://github.com/
|
38
|
+
homepage: http://github.com/skalnik/euler
|
39
|
+
licenses: []
|
40
|
+
|
68
41
|
post_install_message:
|
69
42
|
rdoc_options:
|
70
|
-
- --
|
71
|
-
- README.txt
|
43
|
+
- --charset=UTF-8
|
72
44
|
require_paths:
|
73
45
|
- lib
|
74
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -85,10 +57,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
57
|
version:
|
86
58
|
requirements: []
|
87
59
|
|
88
|
-
rubyforge_project:
|
89
|
-
rubygems_version: 1.3.
|
60
|
+
rubyforge_project:
|
61
|
+
rubygems_version: 1.3.5
|
90
62
|
signing_key:
|
91
|
-
specification_version:
|
63
|
+
specification_version: 3
|
92
64
|
summary: A small library to help solve Projet Euler problems.
|
93
65
|
test_files:
|
66
|
+
- test/tc_integer_methods.rb
|
67
|
+
- test/tc_module.rb
|
94
68
|
- test/test_euler.rb
|
data.tar.gz.sig
DELETED
data/History.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
=== 1.0.7 /
|
2
|
-
* Fixed error in Integer#prime_factors
|
3
|
-
|
4
|
-
=== 1.0.6 /
|
5
|
-
* Fixed an error in Integer#prime_factors
|
6
|
-
|
7
|
-
=== 1.0.5 /
|
8
|
-
* Fixed another error in Integer#is_fibonacci?
|
9
|
-
|
10
|
-
=== 1.0.4 /
|
11
|
-
* Fixed an error in Integer#is_fibonacci?
|
12
|
-
|
13
|
-
=== 1.0.3 / 2008-08-26
|
14
|
-
* Now added Rakefile for easy development.
|
15
|
-
* Restructured gemspec
|
16
|
-
* Added unit tests to gemspec
|
17
|
-
|
18
|
-
=== 1.0.2 / 2008-08-25
|
19
|
-
* Removed redundant files…
|
20
|
-
|
21
|
-
=== 1.0.0 / 2008-08-25
|
22
|
-
* Initial Release!
|
data/Manifest.txt
DELETED
metadata.gz.sig
DELETED
Binary file
|