epitools 0.4.8 → 0.4.9

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 CHANGED
@@ -1 +1 @@
1
- 0.4.8
1
+ 0.4.9
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{epitools}
8
- s.version = "0.4.8"
8
+ s.version = "0.4.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["epitron"]
@@ -76,6 +76,7 @@ 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",
79
80
  "spec/zopen_spec.rb"
80
81
  ]
81
82
 
@@ -141,6 +141,7 @@ class Path
141
141
  alias_method :extname, :ext
142
142
  alias_method :dirname, :dir
143
143
  alias_method :pathname, :path
144
+ alias_method :to_str, :path
144
145
  alias_method :to_s, :path
145
146
  alias_method :directory?, :dir?
146
147
 
@@ -78,4 +78,10 @@ describe Path do
78
78
  __FILE__.to_path.should == Path.new(__FILE__)
79
79
  end
80
80
 
81
+ it "to_strs" do
82
+ path = Path.new(__FILE__)
83
+ data = File.read(path)
84
+ data.any?.should == true
85
+ end
86
+
81
87
  end
@@ -0,0 +1,73 @@
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
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: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 8
10
- version: 0.4.8
9
+ - 9
10
+ version: 0.4.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - epitron
@@ -115,6 +115,7 @@ files:
115
115
  - spec/spec_helper.rb
116
116
  - spec/sys_spec.rb
117
117
  - spec/zopen_spec.rb
118
+ - spec/tos.rb
118
119
  has_rdoc: true
119
120
  homepage: http://github.com/epitron/epitools
120
121
  licenses:
@@ -161,4 +162,5 @@ test_files:
161
162
  - spec/ratio_spec.rb
162
163
  - spec/spec_helper.rb
163
164
  - spec/sys_spec.rb
165
+ - spec/tos.rb
164
166
  - spec/zopen_spec.rb