Sha256: df3661ae9038b3045e16c4c51038df0bc19289b5fa94ddf208fe2f5193a56ad7

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

module RedisDatapump
  class Exporter
    def initialize opts
      @options = opts
    end

    def export &blk
      Validator.new(@options).validate!
      keys('*').each do |key|
        blk.call(ValueExtractor.new(redis_client, key).content)
      end
    end

    private
    def keys glob
      redis_client.keys(glob)
    end

    def redis_client
      return @redis_client if @redis_client
      url = "#{@options[:redis_url]}/#{@options[:redis_database]}"
      @redis_client = Redis.connect(url: url)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis-datapump-0.1.0.alpha1 lib/redis-datapump/exporter.rb