rseed 1.0.5 → 1.0.6

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OGI0MmQ1MjQ1NDBjM2Q4YTk1Zjc4ZTgyNWEyYjc3YjNmZjZiNWQ5Mg==
4
+ OGFiYjJmNWQzZDJkNzgyM2RjZjVmNjI5ZjhmYzI3MWJhMTQxZTExZA==
5
5
  data.tar.gz: !binary |-
6
- ZDRmODFkM2EwNTE2NWY4YjFiYmUzZDM1YzlmYWZjYTNmMjYxYWMxNQ==
6
+ N2VjOGZkMTY3MjE1MWU5MjAyNmJlNWUzMmJiMzhkYTczMjJiZjc2OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGNiODY1NWZmMmIzZjQxY2VkYTAwYTZjM2IxNzI5OTVkNmQyYWFhMmY5NzE5
10
- YTNmNDI5YjcwNWE0NGQ2MTlhNzkxZDA2MmUzZjJhMmJkMDRiMDNmMjIyMTQ3
11
- ZTZkNWJiNTM5NGI5MjY3ODVkNDRmMmY2Y2U1YTcwNDJjYmI1MTQ=
9
+ YjJhYjY0ZjE3YTEwZTNkNzMzYzFmZmJlM2ZlYWY1ZjllY2EwODcxNzJjMGZk
10
+ YjE5MThhMTczYmE3ODhmOGQyMjMyNjcwYzFkMjg3OTk0Yjk3OWViNDljNWFl
11
+ Mzg2M2JiNzRiNjVhYWJiOGVlYWNiY2E3Y2MyNDQ1NzFkODJkOGQ=
12
12
  data.tar.gz: !binary |-
13
- MmI2MTk0ZmQyZjNlMTAxNzk0NGExMTYzNGFjYTVjOTVlZmE1NWMwYzc2OTJk
14
- NzFkOGE3ODg2MmYyNWZjZDFmMGVjY2RhNGI2NThkNjlhOWIwOThlNjA1MTlj
15
- YjAzNWY1YWVjYzlmMjA4MTU3ZjZkNWQ2NmQ0ZGE5ZjBlOTc5NDY=
13
+ NjU0YmIyYmQ4ZWE1Yzc5OTI2OTE2OWQ1ZDU0ODllMzU5OGQ4MjM4NjQyODRj
14
+ YmFlMTFkODM3Mzk1MmVlODQ1MDNjNDA5MWUxODBlYjVhOWEzODEwMWIyMzQ0
15
+ MTFkMWU0YjQ4OTVjYmY1ZDhjYTliOTBlYmUwZWMyMWQwMTM5ODk=
@@ -11,9 +11,9 @@ class <%= @converter_name.camelize %>Converter < Rseed::Converter
11
11
  def <%= @model_name %>_attributes values
12
12
  attributes = {}
13
13
 
14
- [<%= [].tap { |list| (@columns.keys + @relationships.keys).each {|attribute| list << ":#{attribute}"}}.join(", ") %>].each do |attribute|
15
- attributes[attribute] = values[attribute]
16
- end
14
+ [
15
+ <%= [].tap { |list| (@columns.keys + @relationships.keys).each {|attribute| list << ":#{attribute}"}}.join(", ") %>
16
+ ].each { |attribute| attributes[attribute] = values[attribute] }
17
17
 
18
18
  return attributes
19
19
  end
@@ -1,5 +1,7 @@
1
1
  module Rseed
2
2
  class Attribute
3
+ include AttributeConverters
4
+
3
5
  attr_accessor :name
4
6
  attr_accessor :options
5
7
 
@@ -21,7 +23,7 @@ module Rseed
21
23
  !re.match(match_name).nil?
22
24
  end
23
25
 
24
- def deserialize values
26
+ def deserialize values, deserialize_options = {}
25
27
  return nil if values[self.name].nil?
26
28
  value = values[self.name]
27
29
 
@@ -36,7 +38,9 @@ module Rseed
36
38
  elsif options[:type]
37
39
  # Check for a deserialize function for the type
38
40
  dsf = "deserialize_#{options[:type].to_s}"
39
- if self.respond_to? dsf
41
+ if deserialize_options[:converter] && deserialize_options[:converter].respond_to?(dsf)
42
+ value = deserialize_options[:converter].send(dsf, value)
43
+ elsif self.respond_to? dsf
40
44
  value = self.send(dsf, value)
41
45
  end
42
46
  end
@@ -1,7 +1,5 @@
1
1
  module Rseed
2
2
  class Converter
3
- include AttributeConverters
4
-
5
3
  class << self
6
4
  attr_accessor :converter_attributes
7
5
  end
@@ -51,7 +49,7 @@ module Rseed
51
49
  def deserialize_raw values
52
50
  converted_values = HashWithIndifferentAccess.new
53
51
  self.class.converter_attributes.each do |attribute|
54
- converted_values[attribute.name] = attribute.deserialize(values)
52
+ converted_values[attribute.name] = attribute.deserialize(values, converter: self)
55
53
  end
56
54
 
57
55
  deserialize converted_values
data/lib/rseed/helpers.rb CHANGED
@@ -39,6 +39,7 @@ module Rseed
39
39
  progress_bar.format "#{"Complete".green} %t <%B> %C (%a)"
40
40
  progress_bar.finish if progress_bar.total
41
41
  when :error
42
+ processor.logger.error "Error processing record #{meta[:record_count]}"
42
43
  processor.logger.error result[:message].to_s.red
43
44
  processor.logger.error result[:error]
44
45
  processor.logger.error result[:backtrace].join('\n') if result[:backtrace]
data/lib/rseed/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rseed
2
- VERSION = "1.0.5"
2
+ VERSION = "1.0.6"
3
3
  end
data/lib/rseed.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "csv"
2
- require "rseed/attribute"
3
2
  require "rseed/attribute_converters"
3
+ require "rseed/attribute"
4
4
  require "rseed/version"
5
5
  require "rseed/adapter"
6
6
  require "rseed/hash_adapter"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rseed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Monagle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2013-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize