Class: Dynamoid::Dumping::BinaryDumper

Inherits:
Base
  • Object
show all
Defined in:
lib/dynamoid/dumping.rb

Overview

string -> StringIO

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Dynamoid::Dumping::Base

Instance Method Details

#process(value) ⇒ Object



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/dynamoid/dumping.rb', line 302

def process(value)
  store_as_binary = if @options[:store_as_native_binary].nil?
                      Dynamoid.config.store_binary_as_native
                    else
                      @options[:store_as_native_binary]
                    end

  if store_as_binary
    if value.is_a?(StringIO) || value.is_a?(IO)
      value
    else
      StringIO.new(value)
    end
  else
    Base64.strict_encode64(value)
  end
end