epitools 0.5.110 → 0.5.111

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3577b73c4506ea3c81d562a63ea60bc8289cf4c2b7b28bde2ca11cfc350e9124
4
- data.tar.gz: c191915dcda3fac5127e74189cf3132a25a99c791efed58834b891a6f5115765
3
+ metadata.gz: 3d2e24ebc0ca331f63f356f9275773499b86ab48c3880be8169a5936afba4f58
4
+ data.tar.gz: 78af329f856014c8d2693cf1654c1479721ab75ca8938fb26c5f1d8c73609686
5
5
  SHA512:
6
- metadata.gz: 94fec59563b243fb37e6ef14e53b311fee02bc6445136d04ce53fc40e8d851d00e242a5a517bb7ae5b9120ee772c4d0e6b5f9aaa3bad30e2366bf852a71de07f
7
- data.tar.gz: 41e29174f1b776d06931292ee8820e902865d5a360ad2ee949165f3ee8495668d3e668b6328f49c741297feffac00d0ff58a5635a5f9664927f60f0ec4ce4d8d
6
+ metadata.gz: eb0f9dbcc7c796e31ed5db2868823b94e15517ccf8f4ae7f967c006674d5ed82ba63d6719254bdf0f176b2b0f5ebe17a80b39580571259f9e7563dfc1895630d
7
+ data.tar.gz: 2391e6edc69384fa38081bf91869f0b456da3a828d21f66e012a08a2b8268d47747252dc0d2e40635040463e45ee20ff6d88d7d6e9bf17fa31e6290ab211405b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.110
1
+ 0.5.111
@@ -6,6 +6,7 @@ require 'epitools/core_ext/object'
6
6
  require 'epitools/core_ext/string'
7
7
  require 'epitools/core_ext/array'
8
8
  require 'epitools/core_ext/file'
9
+ require 'epitools/core_ext/io'
9
10
  require 'epitools/core_ext/enumerable'
10
11
  require 'epitools/core_ext/hash'
11
12
  require 'epitools/core_ext/numbers'
@@ -0,0 +1,32 @@
1
+ require 'epitools/minimal'
2
+
3
+ class IO
4
+
5
+ unless IO.respond_to? :copy_stream
6
+ #
7
+ # IO.copy_stream backport
8
+ #
9
+ def self.copy_stream(input, output)
10
+ while chunk = input.read(8192)
11
+ output.write(chunk)
12
+ end
13
+ end
14
+ end
15
+
16
+ #
17
+ # Iterate over each line of the stream, yielding the line and the byte offset of the start of the line in the file
18
+ #
19
+ def each_line_with_offset
20
+ return to_enum(:each_line_with_offset) unless block_given?
21
+
22
+ offset = 0
23
+
24
+ each_line do |line|
25
+ yield line, offset
26
+ offset += line.bytesize
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+
@@ -96,7 +96,6 @@ class Proc
96
96
  end
97
97
 
98
98
 
99
-
100
99
  unless defined?(BasicObject)
101
100
  #
102
101
  # Backported BasicObject for Ruby 1.8
@@ -107,80 +106,6 @@ unless defined?(BasicObject)
107
106
  end
108
107
 
109
108
 
110
-
111
- class Object
112
-
113
- #
114
- # Negates a boolean, chained-method style.
115
- #
116
- # Example:
117
- # >> 10.even?
118
- # => true
119
- # >> 10.not.even?
120
- # => false
121
- #
122
- def not
123
- NotWrapper.new(self)
124
- end
125
-
126
- end
127
-
128
- class NotWrapper < BasicObject # :nodoc:
129
- def initialize(orig)
130
- @orig = orig
131
- end
132
-
133
- def inspect
134
- "{NOT #{@orig.inspect}}"
135
- end
136
-
137
- def is_a?(other)
138
- other === self
139
- end
140
-
141
- def method_missing(meth, *args, &block)
142
- result = @orig.send(meth, *args, &block)
143
- if result.is_a? ::TrueClass or result.is_a? ::FalseClass
144
- !result
145
- else
146
- raise "Sorry, I don't know how to invert #{result.inspect}"
147
- end
148
- end
149
- end
150
-
151
-
152
-
153
-
154
- class IO
155
-
156
- unless IO.respond_to? :copy_stream
157
- #
158
- # IO.copy_stream backport
159
- #
160
- def self.copy_stream(input, output)
161
- while chunk = input.read(8192)
162
- output.write(chunk)
163
- end
164
- end
165
- end
166
-
167
- #
168
- # Iterate over each line of the stream, yielding the line and the byte offset of the start of the line in the file
169
- #
170
- def each_line_with_offset
171
- return to_enum(:each_line_with_offset) unless block_given?
172
-
173
- offset = 0
174
-
175
- each_line do |line|
176
- yield line, offset
177
- offset += line.size
178
- end
179
- end
180
-
181
- end
182
-
183
-
184
109
  class Struct
185
110
 
186
111
  #
@@ -190,4 +190,44 @@ class Object
190
190
  true
191
191
  end
192
192
 
193
+
194
+ #
195
+ # Negates a boolean, chained-method style.
196
+ #
197
+ # Example:
198
+ # >> 10.even?
199
+ # => true
200
+ # >> 10.not.even?
201
+ # => false
202
+ #
203
+ def not
204
+ NotWrapper.new(self)
205
+ end
206
+
207
+
193
208
  end
209
+
210
+
211
+ class NotWrapper < BasicObject # :nodoc:
212
+ def initialize(orig)
213
+ @orig = orig
214
+ end
215
+
216
+ def inspect
217
+ "{NOT #{@orig.inspect}}"
218
+ end
219
+
220
+ def is_a?(other)
221
+ other === self
222
+ end
223
+
224
+ def method_missing(meth, *args, &block)
225
+ result = @orig.send(meth, *args, &block)
226
+ if result.is_a? ::TrueClass or result.is_a? ::FalseClass
227
+ !result
228
+ else
229
+ raise "Sorry, I don't know how to invert #{result.inspect}"
230
+ end
231
+ end
232
+ end
233
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: epitools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.110
4
+ version: 0.5.111
5
5
  platform: ruby
6
6
  authors:
7
7
  - epitron
@@ -55,6 +55,7 @@ files:
55
55
  - lib/epitools/core_ext/enumerable.rb
56
56
  - lib/epitools/core_ext/file.rb
57
57
  - lib/epitools/core_ext/hash.rb
58
+ - lib/epitools/core_ext/io.rb
58
59
  - lib/epitools/core_ext/matrix.rb
59
60
  - lib/epitools/core_ext/misc.rb
60
61
  - lib/epitools/core_ext/numbers.rb