csv_step_importer 0.7.2 → 0.7.3

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
  SHA256:
3
- metadata.gz: 90f560bbe09d5c78f5a67ad49bcddb0a50870c5da45df5e87b5abc1b1dde40cc
4
- data.tar.gz: '083b460c4c305ccbb15dd1006839d7b2afc81027ec5bb784442639fbadb14e79'
3
+ metadata.gz: 010566e1eef5979197228e21e4b1767c46b4a01dac5b2c5b2a5ab0ced475728a
4
+ data.tar.gz: a471e746cef84c4466b064d73da3d8528d68a285cd579b3f5a51ed9ba81a1ffb
5
5
  SHA512:
6
- metadata.gz: e0c17830f9193031fdf88f87f396851d166d0c83930b238e78054f84433cea1cee8133727d195552dd39310d6bf8112b65c0e546297fe2502dfbf4f716b792d9
7
- data.tar.gz: 8a616b6337b339f41203935b8145eff654cea234f4cf256fa8d835c80da648794db1bfe902979fa54932554732b68a533c99b5492563690c165f15c9359ebb7d
6
+ metadata.gz: e85c978b53a36fc142780d740b20929a5352ab9c76c537e6ce323893425192da56d5ace7c1b01fea93ea5388f0daa160955d2d2b1908afc752273b512e0f7ef3
7
+ data.tar.gz: ca0dc39aed81533c2de6323e7b112f83783845846a83eb346db641b8ed65adc76ce9b53bb0ba846638ffcca8c88a41e67f490e91587c4a15c868a3746f5754c3
@@ -22,7 +22,21 @@ module CSVStepImporter
22
22
 
23
23
  def value
24
24
  @value ||= columns.each_with_object({}) do |key, values|
25
- values[key] = respond_to?(key) ? send(key) : attributes[key]
25
+ values[key] = value_for_key key
26
+ end
27
+ end
28
+
29
+ def value_for_key key
30
+ if respond_to?(key)
31
+ send key
32
+ elsif attributes.include? key
33
+ attributes[key]
34
+ elsif row.respond_to?(key)
35
+ row.send key
36
+ elsif row.attributes.include? key
37
+ row.attributes[key]
38
+ else
39
+ nil
26
40
  end
27
41
  end
28
42
 
@@ -12,10 +12,12 @@ module CSVStepImporter
12
12
  raise "please extend and implement"
13
13
  end
14
14
 
15
+ # set to nil in order to deactivate
15
16
  def importer_class
16
17
  CSVStepImporter::Model::Importer
17
18
  end
18
19
 
20
+ # set to nil in order to deactivate
19
21
  def reflector_class
20
22
  CSVStepImporter::Model::Reflector
21
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CSVStepImporter
4
- VERSION = "0.7.2"
4
+ VERSION = "0.7.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_step_importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian-Manuel Butzke