super_mapper 0.2.0 → 0.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/super_mapper.rb +4 -0
- data/lib/super_mapper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 92e1c7f01738548d461d348bc2f9786e90352de346d44624316f6fc8da250b12
|
|
4
|
+
data.tar.gz: 3467df91e630b1369d97fdc24132ff0614b3b1812c59001bc2b573c550c0886a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1272db3b526112df424732eb66709e8c841f1ea8355afa49f7140381dcd3cbc26e47ba1eeb46b8f3c567e9e17fbf9f765f2a02dcc76b15f04474320698e9c230
|
|
7
|
+
data.tar.gz: 9928d4a08ae07b0ced6ac497d05c266a8fdadf0818d1dce9f04a5a68b3b79977db41e4c2b3a3d5b64469909a5fc791f3572c29db159f5a3c4cce17a84d84c7d1
|
data/Gemfile.lock
CHANGED
data/lib/super_mapper.rb
CHANGED
|
@@ -22,6 +22,10 @@ class SuperMapper
|
|
|
22
22
|
# @param [Object | Class] target the target object or class. If a class is given, it should have a no-args constructor since the new instance will be created calling +target.new+
|
|
23
23
|
# @return [Object] the target object, or a new instance of the target class, filled with values coming from the source
|
|
24
24
|
def map source, target
|
|
25
|
+
return if source.nil?
|
|
26
|
+
|
|
27
|
+
raise ArgumentError, 'target cannot be nil' if target.nil?
|
|
28
|
+
|
|
25
29
|
target.is_a?(Class) ? map_object(source, target.new) : map_object(source, target)
|
|
26
30
|
end
|
|
27
31
|
|
data/lib/super_mapper/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: super_mapper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matteo Joliveau
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-02-
|
|
11
|
+
date: 2019-02-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|