Class: Dynamoid::Dumping::BooleanDumper

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

Overview

True/False -> True/False/string

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


276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/dynamoid/dumping.rb', line 276

def process(value)
  unless value.nil?
    store_as_boolean = if @options[:store_as_native_boolean].nil?
                         Dynamoid.config.store_boolean_as_native
                       else
                         @options[:store_as_native_boolean]
                       end
    if store_as_boolean
      !!value
    else
      value.to_s[0] # => "f" or "t"
    end
  end
end