virtus-mapper 0.1.2 → 0.1.3

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6e6f67ace3030ffaa3e8c7c03831ca73eee61fb
4
- data.tar.gz: 90495b5b710796fbc395c93a495c2248476d021c
3
+ metadata.gz: 3d6d28f150fb62eacfa306509f4dcdd028c11aaf
4
+ data.tar.gz: 0be0b2f44a38c3d9e300fa5be1c1f43864723418
5
5
  SHA512:
6
- metadata.gz: 3f63dc3d447d17221ed3565d149733834a9676fbb1e270278f94cd9a8165f5ffd256c0c72777604665557555b220cc3042b0005df5a40e58deb97f0f775d2283
7
- data.tar.gz: ac2d3f799a526e95891e097fcf05a972cde4574cacb56aaf64da97b8e0f59e874a9ff17a09aef1ab0b3eeb33e6b6924b9aa39c3c6a1a7e63cd8bd5ebce8bca22
6
+ metadata.gz: ee0175a90dd63624ea349ee0605bc7b43bd501b37deb76bba392660106b370f42ab26c7ef0a00564e0593e834cc427ef2277fac662d1ce32636b1cac36d01918
7
+ data.tar.gz: 0497d8cdf327cfffdbba9f65cca6a12c3b12718751f8ca2747cddadd4e84caef7eb9f0ef568460c0beb13542685ebc1391cfa3a8f15b6ee02bf1dcb96839afc6
@@ -1,5 +1,5 @@
1
1
  module Virtus
2
2
  module Mapper
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
5
5
  end
data/lib/virtus/mapper.rb CHANGED
@@ -7,7 +7,7 @@ HWIA = ActiveSupport::HashWithIndifferentAccess
7
7
  module Virtus
8
8
  module Mapper
9
9
 
10
- def initialize(attrs)
10
+ def initialize(attrs={})
11
11
  super(map_attributes!(HWIA.new(attrs)))
12
12
  end
13
13
 
@@ -18,6 +18,13 @@ module Virtus
18
18
  default: '',
19
19
  from: lambda { |atts| atts[:address][:street] rescue '' }
20
20
  end
21
+
22
+ class Narwhal
23
+ include Virtus.model
24
+ include Virtus::Mapper
25
+
26
+ attribute :name, String, from: :narwhalmom
27
+ end
21
28
  end
22
29
  end
23
30
 
@@ -79,5 +86,12 @@ module Virtus
79
86
  expect(mapper.last_name).to eq('Doe')
80
87
  end
81
88
 
89
+ describe 'given no arguments to constructor' do
90
+ it 'does not raise error' do
91
+ expect {
92
+ Examples::Narwhal.new
93
+ }.not_to raise_error
94
+ end
95
+ end
82
96
  end
83
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtus-mapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - RentPath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-03 00:00:00.000000000 Z
11
+ date: 2014-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus