epitools 0.4.9 → 0.4.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/epitools.gemspec +2 -3
- data/lib/epitools/basetypes.rb +0 -0
- data/lib/epitools/path.rb +17 -12
- data/spec/basetypes_spec.rb +0 -0
- data/spec/path_spec.rb +0 -0
- metadata +4 -6
- data/spec/tos.rb +0 -73
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.10
|
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.4.
|
8
|
+
s.version = "0.4.10"
|
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{2011-02-
|
12
|
+
s.date = %q{2011-02-02}
|
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 = [
|
@@ -76,7 +76,6 @@ Gem::Specification.new do |s|
|
|
76
76
|
"spec/ratio_spec.rb",
|
77
77
|
"spec/spec_helper.rb",
|
78
78
|
"spec/sys_spec.rb",
|
79
|
-
"spec/tos.rb",
|
80
79
|
"spec/zopen_spec.rb"
|
81
80
|
]
|
82
81
|
|
data/lib/epitools/basetypes.rb
CHANGED
File without changes
|
data/lib/epitools/path.rb
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
require 'epitools/basetypes'
|
2
2
|
|
3
|
-
class String
|
4
|
-
def to_path
|
5
|
-
Path.new(self)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
3
|
class Path
|
10
4
|
|
11
|
-
|
12
5
|
## initializers
|
13
6
|
|
14
7
|
def initialize(newpath)
|
@@ -30,6 +23,8 @@ class Path
|
|
30
23
|
|
31
24
|
## setters
|
32
25
|
|
26
|
+
attr_writer :base
|
27
|
+
|
33
28
|
def path=(newpath)
|
34
29
|
if File.exists? newpath
|
35
30
|
if File.directory? newpath
|
@@ -77,7 +72,7 @@ class Path
|
|
77
72
|
end
|
78
73
|
|
79
74
|
|
80
|
-
##
|
75
|
+
## getters
|
81
76
|
|
82
77
|
attr_reader :dirs, :base, :ext
|
83
78
|
|
@@ -137,14 +132,24 @@ class Path
|
|
137
132
|
|
138
133
|
## aliases
|
139
134
|
|
135
|
+
alias_method :to_path, :path
|
136
|
+
alias_method :to_str, :path
|
137
|
+
alias_method :to_s, :path
|
138
|
+
|
139
|
+
alias_method :pathname, :path
|
140
140
|
alias_method :basename, :base
|
141
|
+
alias_method :basename=, :base=
|
141
142
|
alias_method :extname, :ext
|
143
|
+
alias_method :extname=, :ext=
|
142
144
|
alias_method :dirname, :dir
|
143
|
-
alias_method :
|
144
|
-
alias_method :
|
145
|
-
alias_method :
|
146
|
-
alias_method :directory
|
145
|
+
alias_method :dirname=, :dir=
|
146
|
+
alias_method :extension, :ext
|
147
|
+
alias_method :extension=, :ext=
|
148
|
+
alias_method :directory, :dir
|
149
|
+
alias_method :directory=, :dir=
|
147
150
|
|
151
|
+
alias_method :directory?, :dir?
|
152
|
+
|
148
153
|
|
149
154
|
## comparisons
|
150
155
|
|
data/spec/basetypes_spec.rb
CHANGED
File without changes
|
data/spec/path_spec.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epitools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 0.4.
|
9
|
+
- 10
|
10
|
+
version: 0.4.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- epitron
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-02 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -115,7 +115,6 @@ files:
|
|
115
115
|
- spec/spec_helper.rb
|
116
116
|
- spec/sys_spec.rb
|
117
117
|
- spec/zopen_spec.rb
|
118
|
-
- spec/tos.rb
|
119
118
|
has_rdoc: true
|
120
119
|
homepage: http://github.com/epitron/epitools
|
121
120
|
licenses:
|
@@ -162,5 +161,4 @@ test_files:
|
|
162
161
|
- spec/ratio_spec.rb
|
163
162
|
- spec/spec_helper.rb
|
164
163
|
- spec/sys_spec.rb
|
165
|
-
- spec/tos.rb
|
166
164
|
- spec/zopen_spec.rb
|
data/spec/tos.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
# to_s vs. to_str test
|
2
|
-
|
3
|
-
module String_Test
|
4
|
-
def initialize(arg)
|
5
|
-
@test = arg
|
6
|
-
end
|
7
|
-
|
8
|
-
def to_s
|
9
|
-
puts 'to_s called!'
|
10
|
-
'to_s ' + @test
|
11
|
-
end
|
12
|
-
|
13
|
-
def to_str
|
14
|
-
puts 'to_str called!'
|
15
|
-
'to_str ' + @test
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Both
|
20
|
-
include String_Test
|
21
|
-
end
|
22
|
-
|
23
|
-
class No_to_s
|
24
|
-
include String_Test
|
25
|
-
undef_method :to_s
|
26
|
-
end
|
27
|
-
|
28
|
-
class No_to_str
|
29
|
-
include String_Test
|
30
|
-
undef_method :to_str
|
31
|
-
end
|
32
|
-
|
33
|
-
class Neither
|
34
|
-
include String_Test
|
35
|
-
undef_method :to_s
|
36
|
-
undef_method :to_str
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
[Both, No_to_s, No_to_str, Neither].each do |curr_class|
|
41
|
-
puts
|
42
|
-
puts '=' * 40
|
43
|
-
puts curr_class.to_s
|
44
|
-
puts '=' * 40
|
45
|
-
|
46
|
-
t = curr_class.new('foo')
|
47
|
-
[
|
48
|
-
%q{t },
|
49
|
-
%q{p t },
|
50
|
-
%q{print t, "\n" },
|
51
|
-
%q{puts t },
|
52
|
-
%q{puts t.to_s },
|
53
|
-
%q{puts t, t },
|
54
|
-
%q{"#{t}" },
|
55
|
-
%q{puts "#{t}" },
|
56
|
-
%q{puts t.to_str },
|
57
|
-
%q{puts 'ADDING:' + t },
|
58
|
-
%q{'123'.split(t) },
|
59
|
-
%q{Dir.glob(t) },
|
60
|
-
%q{File.new(t) },
|
61
|
-
%q{/./.match(t) },
|
62
|
-
%q{nil.respond_to?(t) },
|
63
|
-
|
64
|
-
].each do |code|
|
65
|
-
puts 'RUNNING: ' + code
|
66
|
-
begin
|
67
|
-
eval code
|
68
|
-
rescue Exception => e
|
69
|
-
puts "ERROR: #{e}"
|
70
|
-
end
|
71
|
-
puts '-' * 20
|
72
|
-
end
|
73
|
-
end
|