Sha256: df7057989cc013a702d9d5192a75fc003b2cf9f9bbcf4b7ff17f49664bbf845d

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

module DmAdapterSimpledb
  module Utils
    class NullObject
      def method_missing(*args, &block)
        self
      end
    end

    class NullSdbInterface
      def initialize(logger=NullObject.new)
        @logger = logger
      end

      def select(*args, &block)
        @logger.debug "[SELECT] #{args.inspect}"
        {
          :items => []
        }
      end

      def get_attributes(*args, &block)
        @logger.debug "[GET_ATTRIBUTES] #{args.inspect}"
        {}
      end

      def list_domains(*args, &block)
        @logger.debug "[LIST_DOMAINS] #{args.inspect}"
        {}
      end

      def put_attributes(*args, &block)
        @logger.debug "[PUT_ATTRIBUTES] #{args.inspect}"
        {}
      end

      def delete_attributes(*args, &block)
        @logger.debug "[DELETE_ATTRIBUTES] #{args.inspect}"
        {}
      end

      def create_domain(*args, &block)
        @logger.debug "[CREATE_DOMAIN] #{args.inspect}"
        {}
      end
    end

    def transform_hash(original, options={}, &block)
      original.inject({}){|result, (key,value)|
        value = if (options[:deep] && Hash === value) 
                  transform_hash(value, options, &block)
                else 
                  value
                end
        block.call(result,key,value)
        result
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-adapter-simpledb-1.5.0 lib/dm-adapter-simpledb/utils.rb
dm-adapter-simpledb-1.4.0 lib/dm-adapter-simpledb/utils.rb