aduki 0.0.8 → 0.0.9

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.
data/lib/aduki.rb CHANGED
@@ -30,6 +30,8 @@ module Aduki
30
30
  end
31
31
 
32
32
  def self.to_value klass, setter, value
33
+ return value.map { |v| to_value klass, setter, v} if value.is_a? Array
34
+
33
35
  type = klass.aduki_type_for_attribute_name setter
34
36
  if type.is_a? Hash
35
37
  to_typed_hash type.values.first, value
data/lib/aduki/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aduki
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
@@ -0,0 +1,25 @@
1
+ require "aduki"
2
+ require "spec_helper"
3
+
4
+ describe Aduki::Initializer do
5
+
6
+ it "should assign an integer attribute" do
7
+ props = {
8
+ "name" => "Foo",
9
+ "assemblies" => [{ "name" => "A0", "height" => "10" }, { "name" => "A1", "height" => "20" }, { "name" => "A2", "height" => "30" }, ]
10
+ }
11
+
12
+ machine = Machine.new props
13
+
14
+ expect(machine.name).to eq "Foo"
15
+
16
+ expect(machine.assemblies[0].name).to eq "A0"
17
+ expect(machine.assemblies[0].height).to eq 10
18
+
19
+ expect(machine.assemblies[1].name).to eq "A1"
20
+ expect(machine.assemblies[1].height).to eq 20
21
+
22
+ expect(machine.assemblies[2].name).to eq "A2"
23
+ expect(machine.assemblies[2].height).to eq 30
24
+ end
25
+ end
data/spec/to_date_spec.rb CHANGED
@@ -28,7 +28,6 @@ describe Aduki::Initializer do
28
28
  contraption = Contraption.new props
29
29
 
30
30
  expect(contraption.updated).to be_a Time
31
- puts contraption.updated.inspect
32
31
  expect(contraption.updated.year).to eq 1945
33
32
  expect(contraption.updated.month).to eq 1
34
33
  expect(contraption.updated.day).to eq 19
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aduki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
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: 2014-02-08 00:00:00.000000000 Z
12
+ date: 2014-02-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -59,6 +59,7 @@ files:
59
59
  - aduki.gemspec
60
60
  - lib/aduki.rb
61
61
  - lib/aduki/version.rb
62
+ - spec/array_attribute_spec.rb
62
63
  - spec/initializer_spec.rb
63
64
  - spec/model.rb
64
65
  - spec/nil_initializer_spec.rb
@@ -92,6 +93,7 @@ signing_key:
92
93
  specification_version: 3
93
94
  summary: set object attributes recursively from an attributes hash
94
95
  test_files:
96
+ - spec/array_attribute_spec.rb
95
97
  - spec/initializer_spec.rb
96
98
  - spec/model.rb
97
99
  - spec/nil_initializer_spec.rb