ruby-nuggets 0.6.3 → 0.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README +1 -1
- data/Rakefile +2 -2
- data/lib/nuggets/integer/map.rb +5 -0
- data/lib/nuggets/integer/map_mixin.rb +43 -0
- data/lib/nuggets/version.rb +1 -1
- metadata +10 -8
data/README
CHANGED
data/Rakefile
CHANGED
@@ -0,0 +1,43 @@
|
|
1
|
+
#--
|
2
|
+
###############################################################################
|
3
|
+
# #
|
4
|
+
# A component of ruby-nuggets, some extensions to the Ruby programming #
|
5
|
+
# language. #
|
6
|
+
# #
|
7
|
+
# Copyright (C) 2007-2010 Jens Wille #
|
8
|
+
# #
|
9
|
+
# Authors: #
|
10
|
+
# Jens Wille <jens.wille@uni-koeln.de> #
|
11
|
+
# #
|
12
|
+
# ruby-nuggets is free software; you can redistribute it and/or modify it #
|
13
|
+
# under the terms of the GNU General Public License as published by the Free #
|
14
|
+
# Software Foundation; either version 3 of the License, or (at your option) #
|
15
|
+
# any later version. #
|
16
|
+
# #
|
17
|
+
# ruby-nuggets is distributed in the hope that it will be useful, but WITHOUT #
|
18
|
+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
|
20
|
+
# more details. #
|
21
|
+
# #
|
22
|
+
# You should have received a copy of the GNU General Public License along #
|
23
|
+
# with ruby-nuggets. If not, see <http://www.gnu.org/licenses/>. #
|
24
|
+
# #
|
25
|
+
###############################################################################
|
26
|
+
#++
|
27
|
+
|
28
|
+
module Nuggets
|
29
|
+
class Integer
|
30
|
+
module MapMixin
|
31
|
+
|
32
|
+
# call-seq:
|
33
|
+
# int.map_positive => anInteger
|
34
|
+
#
|
35
|
+
# Creates a bijection from *Z* to *N*, i.e., it maps _int_ to a positive
|
36
|
+
# integer.
|
37
|
+
def map_positive
|
38
|
+
2 * abs + (self > 0 ? 0 : 1)
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/nuggets/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-nuggets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 4
|
10
|
+
version: 0.6.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jens Wille
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-17 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -31,6 +31,8 @@ extra_rdoc_files:
|
|
31
31
|
- README
|
32
32
|
files:
|
33
33
|
- lib/nuggets.rb
|
34
|
+
- lib/nuggets/integer/map_mixin.rb
|
35
|
+
- lib/nuggets/integer/map.rb
|
34
36
|
- lib/nuggets/integer/to_binary_s.rb
|
35
37
|
- lib/nuggets/integer/factorial.rb
|
36
38
|
- lib/nuggets/integer/length_mixin.rb
|
@@ -132,14 +134,14 @@ licenses: []
|
|
132
134
|
|
133
135
|
post_install_message:
|
134
136
|
rdoc_options:
|
135
|
-
- --
|
136
|
-
-
|
137
|
+
- --title
|
138
|
+
- ruby-nuggets Application documentation
|
137
139
|
- --main
|
138
140
|
- README
|
141
|
+
- --line-numbers
|
142
|
+
- --inline-source
|
139
143
|
- --charset
|
140
144
|
- UTF-8
|
141
|
-
- --title
|
142
|
-
- ruby-nuggets Application documentation
|
143
145
|
- --all
|
144
146
|
require_paths:
|
145
147
|
- lib
|