Sha256: 17bd3484fbfacebf959f6b3ba7697e6ea05b0600e468d4c309bf345fdefa59f3

Contents?: true

Size: 737 Bytes

Versions: 3

Compression:

Stored size: 737 Bytes

Contents

# encoding: utf-8

module RedisCopy
  module UI
    def self.load(options = {})
      ui = options.fetch(:ui, :auto_run)
      const_name = ui.to_s.camelize
      require "redis-copy/ui/#{ui}" unless const_defined?(const_name)
      const_get(const_name).new(options)
    end

    def initialize(options)
      @options = options
    end

    def confirm?(prompt)
      return super if defined?(super)
      raise NotImplementedError
    end

    def abort(message = nil)
      return super if defined?(super)
      raise NotImplementedError
    end

    def notify(message)
      return super if defined?(super)
      raise NotImplementedError
    end

    def debug(message)
      notify(message) if @options[:debug]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis-copy-0.0.3 lib/redis-copy/ui.rb
redis-copy-0.0.2 lib/redis-copy/ui.rb
redis-copy-0.0.1 lib/redis-copy/ui.rb