moonmaster9000-dupe 0.3.1 → 0.3.2

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 (3) hide show
  1. data/lib/dupe/dupe.rb +4 -4
  2. data/lib/dupe/record.rb +9 -1
  3. metadata +1 -1
data/lib/dupe/dupe.rb CHANGED
@@ -74,7 +74,7 @@ class Dupe
74
74
  # will ask Dupe to mock ActiveResource responses to find(:all) and find(:id) with the data
75
75
  # specified in the cucumber hash table immediately following the "Given the following author:" line.
76
76
  # Since we didn't specify a 'bio' value in our cucumber hash table, Dupe will give it the
77
- # default value 'Bio stub.'. Also, it will transform the 'date_of_birth' value we provided in the hash
77
+ # default value 'Lorem ipsum delor.'. Also, it will transform the 'date_of_birth' value we provided in the hash
78
78
  # table into a time object.
79
79
  #
80
80
  # Similarly, for the :book cucumber hash table, Dupe will transform the author name we provided
@@ -87,7 +87,7 @@ class Dupe
87
87
  # <author>
88
88
  # <id type="integer">1</id>
89
89
  # <name>Arthur C. Clarke</name>
90
- # <bio>Bio stub.</bio>
90
+ # <bio>Lorem ipsum delor.</bio>
91
91
  # <date_of_birth>1917-12-16T00:00:00Z</date_of_birth>
92
92
  # </author>
93
93
  #
@@ -99,7 +99,7 @@ class Dupe
99
99
  # <author>
100
100
  # <id type="integer">1</id>
101
101
  # <name>Arthur C. Clarke</name>
102
- # <bio>Bio stub.</bio>
102
+ # <bio>Lorem ipsum delor.</bio>
103
103
  # <date_of_birth>1917-12-16T00:00:00Z</date_of_birth>
104
104
  # </author>
105
105
  # </book>
@@ -181,7 +181,7 @@ class Dupe
181
181
  # Dupe.define :author {|author| author.name('default')}
182
182
  #
183
183
  #
184
- # the stub would have generated 20 author records like:
184
+ # then stub would have generated 20 author records like:
185
185
  #
186
186
  # {:name => 'default', :id => 1}
187
187
  # ....
data/lib/dupe/record.rb CHANGED
@@ -1,7 +1,15 @@
1
1
  class Dupe
2
2
  class Record #:nodoc:
3
3
  def initialize(hash)
4
- @attributes = hash.merge(hash) {|k,v| v.is_a?(Hash) ? Record.new(v) : v}
4
+ @attributes = hash.merge(hash) do |k,v|
5
+ if v.is_a?(Hash)
6
+ Record.new(v)
7
+ elsif v.is_a?(Array)
8
+ v.map {|r| Record.new(r)}
9
+ else
10
+ v
11
+ end
12
+ end
5
13
  end
6
14
 
7
15
  def method_missing(method_name, *args, &block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moonmaster9000-dupe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Parker