class DynamoDbFramework::HashHelper

Public Instance Methods

hash_kit() click to toggle source
# File lib/dynamodb_framework/hash_helper.rb, line 8
def hash_kit
  @hash_kit ||= HashKit::Helper.new
end
to_hash(obj) click to toggle source
# File lib/dynamodb_framework/hash_helper.rb, line 3
def to_hash(obj)
  hsh = obj.is_a?(Hash) ? obj : hash_kit.to_hash(obj)
  strip_nil(hsh)
end

Private Instance Methods

strip_nil(obj) click to toggle source
# File lib/dynamodb_framework/hash_helper.rb, line 14
def strip_nil(obj)
  remove_nil = ->(*args) do
    val = args.last
    val.delete_if(&remove_nil) if val.respond_to?(:delete_if)
    val.nil?
  end
  obj.delete_if(&remove_nil)
end