Converter 1.1.2.0 → 1.1.3.0

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.
Files changed (2) hide show
  1. data/lib/Converter.rb +10 -0
  2. metadata +2 -2
@@ -14,6 +14,7 @@ module Converter
14
14
  end
15
15
 
16
16
  def copy_to target
17
+ #this shuld not b
17
18
  Converter.copy self, target
18
19
  end
19
20
 
@@ -104,6 +105,10 @@ module Converter
104
105
  source_attribute_name = is_source_convertable ? conversion_metadata.convertable_attribute_name : conversion_metadata.poro_attribute_name
105
106
  target_attribute_name = is_source_convertable ? conversion_metadata.poro_attribute_name : conversion_metadata.convertable_attribute_name
106
107
 
108
+ if not_all_method_defined source, target, source_attribute_name, target_attribute_name
109
+ return
110
+ end
111
+
107
112
  # Get attribute values
108
113
  source_attribute_value = source.send(source_attribute_name)
109
114
  target_attribute_value = target.send(target_attribute_name)
@@ -124,6 +129,11 @@ module Converter
124
129
  target.send(target_attribute_name, target_value)
125
130
  end
126
131
 
132
+ def self.not_all_method_defined source, target, source_attr, target_attr
133
+ ( !source.class.method_defined?(source_attr.to_sym) && !source.singleton_class.method_defined?(source_attr.to_sym)) ||
134
+ ( !target.class.method_defined?(target_attr.to_sym) && !target.singleton_class.method_defined?(target_attr.to_sym))
135
+ end
136
+
127
137
  public
128
138
 
129
139
  # This module add class extension of attr_converter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2.0
4
+ version: 1.1.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-22 00:00:00.000000000 Z
12
+ date: 2012-07-26 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Add attr_converter to maps attributes to another object, and this allows
15
15
  you to copy, convert and clone between them automatically