epitools 0.5.97 → 0.5.98
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/epitools/core_ext/enumerable.rb +11 -2
- data/lib/epitools/core_ext/string.rb +1 -1
- data/spec/core_ext_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e874e17952a2226053ebe922c41e3718b33fd135
|
4
|
+
data.tar.gz: 1164a96660ee0873fb668a8d2709c203f8d06a79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73d5353a6689ac9d7cca3937cf4ae2f3230dc8994a0fad2cf38f837575a28d8d216b131d694cb94b519276609150ba9830905e3eabbe6a57068beb667ab01969
|
7
|
+
data.tar.gz: f42fb7a5392544870b3db6d96e58e67a387a41933361bef51c6f514c3d82ddbacd2222b2c3c69d3acfb4453488abdc97e50fe658b0ccf946f6336864f700ea1b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.98
|
@@ -37,11 +37,20 @@ module Enumerable
|
|
37
37
|
end
|
38
38
|
|
39
39
|
#
|
40
|
-
#
|
40
|
+
# Convert the Enumerable to an array and return a reversed copy
|
41
|
+
#
|
42
|
+
unless defined? reverse
|
43
|
+
def reverse
|
44
|
+
to_a.reverse
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# Iterate over the Enumerable backwards (after converting it to an array)
|
41
50
|
#
|
42
51
|
unless defined? reverse_each
|
43
52
|
def reverse_each
|
44
|
-
to_a.
|
53
|
+
to_a.reverse_each
|
45
54
|
end
|
46
55
|
end
|
47
56
|
|
@@ -244,7 +244,7 @@ class String
|
|
244
244
|
# Raw bytes to an integer (as big as necessary)
|
245
245
|
#
|
246
246
|
def to_i_from_bytes(big_endian=false)
|
247
|
-
bs =
|
247
|
+
bs = big_endian ? bytes.reverse_each : bytes.each
|
248
248
|
bs.with_index.inject(0) { |sum,(b,i)| (b << (8*i)) + sum }
|
249
249
|
end
|
250
250
|
|
data/spec/core_ext_spec.rb
CHANGED
@@ -1012,6 +1012,8 @@ describe File do
|
|
1012
1012
|
tmp << "hi\nthere\neveryone!\n"
|
1013
1013
|
f = open(tmp)
|
1014
1014
|
f.reverse_each.to_a.should == ["everyone!\n", "there\n", "hi\n"]
|
1015
|
+
|
1016
|
+
[1,2,3].to_enum(:each).reverse_each { |x| x.class.should == Integer }
|
1015
1017
|
end
|
1016
1018
|
|
1017
1019
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: epitools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.98
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- epitron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|