cerealizer 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,6 +44,11 @@ module Cerealizer
44
44
  @keys ||= []
45
45
  end
46
46
 
47
+ # Read the keys on each object in a collection of objects.
48
+ def self.read_keys(objects, user)
49
+ objects.map { |object| self.new(object,user).read_keys }
50
+ end
51
+
47
52
  private
48
53
  # TODO - Should the default be writable?
49
54
  def writeable?(key)
@@ -1,3 +1,3 @@
1
1
  module Cerealizer
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -26,11 +26,20 @@ describe Cerealizer do
26
26
  cheerios_serializer.read_keys.keys.should include(:name, :private_notes, :sugar_content)
27
27
  end
28
28
 
29
- it "should serializer values" do
29
+ it "should serialize values" do
30
30
  cheerios_serializer.read_keys.values.should include('Cheerios', '1 gram', 'Tastes like cardboard')
31
31
  end
32
32
  end
33
33
 
34
+ describe ".read_keys" do
35
+ it "should serialize array of objects" do
36
+ array = serializer_klass.read_keys [cheerios, cheerios], brad
37
+ array.each do |hash|
38
+ hash.keys.should include(*serializer_klass.keys.map(&:name))
39
+ end
40
+ end
41
+ end
42
+
34
43
  describe "#write_keys" do
35
44
  it "should update object attributes" do
36
45
  cheerios_serializer.write_keys(:name => 'Captain Crunch').object.name.should == 'Captain Crunch'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cerealizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2013-02-09 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec