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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcb7b057dfd89a787a892fbbc839c89a2a2b2213
4
- data.tar.gz: 0bf96917183fd8298ff61d399444567993d07de0
3
+ metadata.gz: e874e17952a2226053ebe922c41e3718b33fd135
4
+ data.tar.gz: 1164a96660ee0873fb668a8d2709c203f8d06a79
5
5
  SHA512:
6
- metadata.gz: 42fbcc5fe50f0a1b2eb7b49156f73ccb108d70560b3c57bcccd7224686ca5417aef2a83133c5e3cc7ac6c112734200e2b60a22cca5eaa1d35fbe92b5fdbd6214
7
- data.tar.gz: aba4e219db005393dce44cc1712ed31828b65f1e678d96cd7b77a9c60eff0e8bb6f007e314916e847ec247a0f982a81d778dccf4451c9c66749737709f062977
6
+ metadata.gz: 73d5353a6689ac9d7cca3937cf4ae2f3230dc8994a0fad2cf38f837575a28d8d216b131d694cb94b519276609150ba9830905e3eabbe6a57068beb667ab01969
7
+ data.tar.gz: f42fb7a5392544870b3db6d96e58e67a387a41933361bef51c6f514c3d82ddbacd2222b2c3c69d3acfb4453488abdc97e50fe658b0ccf946f6336864f700ea1b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.97
1
+ 0.5.98
@@ -37,11 +37,20 @@ module Enumerable
37
37
  end
38
38
 
39
39
  #
40
- # Add reverse_each to old Ruby versions
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.to_enum(:reverse_each)
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 = reverse ? bytes.reverse_each : bytes.each
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
 
@@ -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.97
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-23 00:00:00.000000000 Z
11
+ date: 2016-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec