remi 0.2.38 → 0.2.39

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: a59538393438e759c02554c7dac61c914841e468
4
- data.tar.gz: 181df9c16e528b0d1315e992fb25a97cc711c678
3
+ metadata.gz: fc73b233d7181b3e40c96c5da2d52bf8d81d99a8
4
+ data.tar.gz: 536421bb23bf564eeb4394f3046467fe1dd9adf4
5
5
  SHA512:
6
- metadata.gz: 92520cd0b2dc002879bfef7cfaf78e8e6f4a3609b121d23c9a04de054fcd86e9dfe8fd1d06b0cef3870a486c948a29994ed58eac6c8caefdd0fbab4d7b06fc8a
7
- data.tar.gz: f50d012217b786c3fdebd97caa1a183545a6e99689f82fce9e888a933a33cd96247b31f63ab0265a80cb443a9cd9258237884a464747ebb75180e481b64d49c4
6
+ metadata.gz: 08307536b89a25d60ddfdaad8595073b90e67e9094f22c709b3005abca6fec4bed5a838270579b4f81df1e803b8fba31c75f5ddb4bb1d263a3d5157006396d90
7
+ data.tar.gz: 344321318f9b76b95af19b8ff0c58d0c528da3bdeed6e15f6f60276513a2c24677cca360cc930d26087394a66082d5047b40706e0a87c8a4b9d5f20788e1ee64
data/Gemfile.lock CHANGED
@@ -19,7 +19,7 @@ GIT
19
19
  PATH
20
20
  remote: .
21
21
  specs:
22
- remi (0.2.38)
22
+ remi (0.2.39)
23
23
  activesupport (~> 4.2)
24
24
  bond (~> 0.5)
25
25
  cucumber (~> 2.1)
@@ -45,9 +45,8 @@ module Remi
45
45
  # sources for a row transformation
46
46
  def initialize(index, values, source_keys: nil)
47
47
  @index = index
48
- @inverted_index = index.invert
49
48
  @values = values
50
- @source_keys = source_keys || index.keys
49
+ @source_keys = source_keys
51
50
  end
52
51
 
53
52
  # Public: Returns the value of the row array for the given key
@@ -62,15 +61,18 @@ module Remi
62
61
 
63
62
  # Public: Makes Row enumerable, and acts like a hash.
64
63
  def each &block
65
- @values.each_with_index { |value, idx| block.call([@inverted_index[idx], value]) }
64
+ inverted_index = @index.invert
65
+ @values.each_with_index { |value, idx| block.call([inverted_index[idx], value]) }
66
66
  end
67
67
 
68
+ # Public: Enumerates over each source value
68
69
  def each_source &block
69
70
  Enumerator.new do |y|
70
71
  source_keys.each { |key| y << [key, self[key]] }
71
72
  end
72
73
  end
73
74
 
75
+ # Public: Enumerates over each target value
74
76
  def each_target &block
75
77
  Enumerator.new do |y|
76
78
  target_keys.each { |key| y << [key, self[key]] }
@@ -87,10 +89,12 @@ module Remi
87
89
  @index.keys
88
90
  end
89
91
 
92
+ # Public: Returns all source keys
90
93
  def source_keys
91
- @source_keys
94
+ @source_keys ||= @index.keys
92
95
  end
93
96
 
97
+ # Public: Returns all target keys
94
98
  def target_keys
95
99
  @target_keys ||= keys - source_keys
96
100
  end
data/lib/remi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Remi
2
- VERSION = '0.2.38'
2
+ VERSION = '0.2.39'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.38
4
+ version: 0.2.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sterling Paramore
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bond