epitools 0.3.3 → 0.3.4
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/VERSION +1 -1
- data/epitools.gemspec +3 -2
- data/lib/epitools.rb +1 -3
- data/lib/epitools/basetypes.rb +17 -5
- data/lib/epitools/sys.rb +3 -1
- data/spec/basetypes_spec.rb +10 -0
- metadata +10 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.4
|
data/epitools.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{epitools}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["epitron"]
|
12
|
-
s.date = %q{2010-12-
|
12
|
+
s.date = %q{2010-12-18}
|
13
13
|
s.description = %q{Miscellaneous utility libraries to make my life easier.}
|
14
14
|
s.email = %q{chris@ill-logic.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -46,6 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
"lib/epitools/zopen.rb",
|
47
47
|
"spec/basetypes_spec.rb",
|
48
48
|
"spec/browser_spec.rb",
|
49
|
+
"spec/clitools_spec.rb",
|
49
50
|
"spec/lcs_spec.rb",
|
50
51
|
"spec/metaclass_spec.rb",
|
51
52
|
"spec/permutations_spec.rb",
|
data/lib/epitools.rb
CHANGED
@@ -9,9 +9,8 @@ require_wrapper = proc do |mod|
|
|
9
9
|
end
|
10
10
|
|
11
11
|
%w[
|
12
|
-
|
13
|
-
basetypes
|
14
12
|
metaclass
|
13
|
+
basetypes
|
15
14
|
niceprint
|
16
15
|
string_to_proc
|
17
16
|
permutations
|
@@ -19,7 +18,6 @@ end
|
|
19
18
|
zopen
|
20
19
|
colored
|
21
20
|
clitools
|
22
|
-
|
23
21
|
].each do |mod|
|
24
22
|
require_wrapper.call mod
|
25
23
|
end
|
data/lib/epitools/basetypes.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'pp'
|
2
2
|
|
3
|
-
# Alias "
|
3
|
+
# Alias "Enumerator" to "Enum"
|
4
|
+
|
5
|
+
if RUBY_VERSION["1.8"]
|
6
|
+
require 'enumerator'
|
7
|
+
Enumerator = Enumerable::Enumerator unless defined? Enumerator
|
8
|
+
end
|
9
|
+
|
4
10
|
unless defined? Enum
|
5
|
-
if defined?
|
6
|
-
Enum = Enumerable::Enumerator
|
7
|
-
elsif defined? Enumerator
|
11
|
+
if defined? Enumerator
|
8
12
|
Enum = Enumerator
|
9
13
|
else
|
10
14
|
$stderr.puts "WARNING: Couldn't find the Enumerator class. Enum will not be available."
|
@@ -74,9 +78,17 @@ class String
|
|
74
78
|
end
|
75
79
|
|
76
80
|
alias_method :clean_lines, :nice_lines
|
81
|
+
|
82
|
+
#
|
83
|
+
# The Infamous Caesar-Cipher. Unbreakable to this day.
|
84
|
+
#
|
85
|
+
def rot13
|
86
|
+
tr('n-za-mN-ZA-M', 'a-zA-Z')
|
87
|
+
end
|
77
88
|
|
78
89
|
end
|
79
90
|
|
91
|
+
|
80
92
|
class Integer
|
81
93
|
|
82
94
|
def blank?; self == 0; end
|
@@ -89,7 +101,7 @@ class Integer
|
|
89
101
|
# Convert the number to an array of bits (least significant digit first).
|
90
102
|
#
|
91
103
|
def to_bits
|
92
|
-
("%b" % self).reverse.
|
104
|
+
("%b" % self).chars.reverse.map(&:to_i)
|
93
105
|
end
|
94
106
|
|
95
107
|
alias_method :bits, :to_bits
|
data/lib/epitools/sys.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
# Cross-platform operating system functions.
|
3
3
|
# Includes: process listing, platform detection, etc.
|
4
4
|
#
|
5
|
+
require 'metaclass'
|
6
|
+
|
5
7
|
module Sys
|
6
8
|
|
7
9
|
#-----------------------------------------------------------------------------
|
@@ -182,7 +184,7 @@ module Sys
|
|
182
184
|
@os = "Darwin"
|
183
185
|
when /linux/
|
184
186
|
@os = "Linux"
|
185
|
-
when /mingw|mswin/
|
187
|
+
when /mingw|mswin|cygwin/
|
186
188
|
@os = 'Windows'
|
187
189
|
else
|
188
190
|
raise "Unknown OS: #{host_os.inspect}"
|
data/spec/basetypes_spec.rb
CHANGED
@@ -75,6 +75,16 @@ describe Numeric do
|
|
75
75
|
|
76
76
|
end
|
77
77
|
|
78
|
+
describe String do
|
79
|
+
|
80
|
+
it "rot13s" do
|
81
|
+
message = "Unbreakable Code"
|
82
|
+
message.rot13.should.not == message
|
83
|
+
message.rot13.rot13.should == message
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
78
88
|
describe Integer do
|
79
89
|
|
80
90
|
it "integer?" do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epitools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- epitron
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-18 00:00:00 -05:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -25,6 +26,7 @@ dependencies:
|
|
25
26
|
requirements:
|
26
27
|
- - ~>
|
27
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
28
30
|
segments:
|
29
31
|
- 2
|
30
32
|
- 2
|
@@ -40,6 +42,7 @@ dependencies:
|
|
40
42
|
requirements:
|
41
43
|
- - ~>
|
42
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 23
|
43
46
|
segments:
|
44
47
|
- 1
|
45
48
|
- 0
|
@@ -55,6 +58,7 @@ dependencies:
|
|
55
58
|
requirements:
|
56
59
|
- - ">="
|
57
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 3
|
58
62
|
segments:
|
59
63
|
- 0
|
60
64
|
version: "0"
|
@@ -99,6 +103,7 @@ files:
|
|
99
103
|
- lib/epitools/zopen.rb
|
100
104
|
- spec/basetypes_spec.rb
|
101
105
|
- spec/browser_spec.rb
|
106
|
+
- spec/clitools_spec.rb
|
102
107
|
- spec/lcs_spec.rb
|
103
108
|
- spec/metaclass_spec.rb
|
104
109
|
- spec/permutations_spec.rb
|
@@ -108,7 +113,6 @@ files:
|
|
108
113
|
- spec/spec_helper.rb
|
109
114
|
- spec/sys_spec.rb
|
110
115
|
- spec/zopen_spec.rb
|
111
|
-
- spec/clitools_spec.rb
|
112
116
|
has_rdoc: true
|
113
117
|
homepage: http://github.com/epitron/epitools
|
114
118
|
licenses:
|
@@ -123,6 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
127
|
requirements:
|
124
128
|
- - ">="
|
125
129
|
- !ruby/object:Gem::Version
|
130
|
+
hash: 3
|
126
131
|
segments:
|
127
132
|
- 0
|
128
133
|
version: "0"
|
@@ -131,6 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
136
|
requirements:
|
132
137
|
- - ">="
|
133
138
|
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
134
140
|
segments:
|
135
141
|
- 0
|
136
142
|
version: "0"
|