Browse files

Don't Read IO Objects in Attribute Value Marshal

Resolves Issue #831

Running the following code exercised the problem, and now works with
this change:

  table_name: "foo",
  item: {
    id: 1,

The issue appeared to be that #read was called twice on the StringIO or
IO object, and the second call would fail as String#read does not
  • Loading branch information...
awood45 committed Jun 2, 2015
1 parent be9b131 commit b59e760b15969671ea9c8cfcbd119fe626aa389e
@@ -34,7 +34,7 @@ def format(obj)
when String then { s: obj }
when Numeric then { n: obj.to_s }
when StringIO, IO then { b: }
when StringIO, IO then { b: obj }
when Set then format_set(obj)
when true, false then { bool: obj }
when nil then { null: true }
@@ -26,6 +26,12 @@ module DynamoDB
it 'converts IO objects to :b (blob)' do
io ='bar')
formatted = value.marshal(foo: io)
expect(formatted[:m]["foo"][:b].read).to eq('bar')
it 'converts string sets to :ss (string set)' do
formatted = value.marshal( mno)))
expect(formatted).to eq(ss: %w(abc mno))

0 comments on commit b59e760

Please sign in to comment.