module Guard::Deprecated::Guard::ClassMethods

def []=(key, value)

def []=(key, value)
  case key
  when :clear
    ::Guard.state.session.clearing(value)
  else
    msg = "Oops! Guard.option[%s]= is unhandled or unsupported." \
      "Please file an issue if you rely on this option working."
    fail NotImplementedError, format(msg, key)
  end
end

def add_group(name, options = {})

def add_group(name, options = {})
  UI.deprecation(ADD_GROUP)
  ::Guard.state.session.groups.add(name, options)
end

def add_guard(*args)

def add_guard(*args)
  ::Guard::UI.deprecation(ADD_GUARD)
  add_plugin(*args)
end

def add_plugin(name, options = {})

def add_plugin(name, options = {})
  UI.deprecation(ADD_PLUGIN)
  ::Guard.state.session.plugins.add(name, options)
end

def evaluate_guardfile

def evaluate_guardfile
  UI.deprecation(EVALUATE_GUARDFILE)
  options = ::Guard.state.session.evaluator_options
  evaluator = ::Guard::Guardfile::Evaluator.new(options)
  evaluator.evaluate
  msg = "No plugins found in Guardfile, please add at least one."
  ::Guard::UI.error msg if _pluginless_guardfile?
end

def evaluator

def evaluator
  UI.deprecation(EVALUATOR)
  options = ::Guard.state.session.evaluator_options
  ::Guard::Guardfile::Evaluator.new(options)
end

def fetch(key, *args)

def fetch(key, *args)
  hash = to_hash
  verify_key!(hash, key)
  hash.fetch(key, *args)
end

def get_guard_class(name, fail_gracefully = false)

def get_guard_class(name, fail_gracefully = false)
  UI.deprecation(GET_GUARD_CLASS)
  PluginUtil.new(name).plugin_class(fail_gracefully: fail_gracefully)
end

def group(filter)

def group(filter)
  UI.deprecation(GROUP)
  ::Guard.state.session.groups.all(filter).first
end

def groups(filter)

def groups(filter)
  UI.deprecation(GROUPS)
  ::Guard.state.session.groups.all(filter)
end

def guard_gem_names

def guard_gem_names
  UI.deprecation(GUARD_GEM_NAMES)
  PluginUtil.plugin_names
end

def guards(filter = nil)

def guards(filter = nil)
  ::Guard::UI.deprecation(GUARDS)
  ::Guard.state.session.plugins.all(filter)
end

def initialize

def initialize
  super(to_hash)
end

def listener=(_)

def listener=(_)
  UI.deprecation(LISTENER_ASSIGN)
  ::Guard.listener
end

def locate_guard(name)

def locate_guard(name)
  UI.deprecation(LOCATE_GUARD)
  PluginUtil.new(name).plugin_location
end

def lock

def lock
  UI.deprecation(LOCK)
end

def options

def options
  UI.deprecation(OPTIONS)
  Class.new(Hash) do
    def initialize
      super(to_hash)
    end
    def to_hash
      session = ::Guard.state.session
      {
        clear: session.clearing?,
        debug: session.debug?,
        watchdir: Array(session.watchdirs).map(&:to_s),
        notify: session.notify_options[:notify],
        no_interactions: (session.interactor_name == :sleep)
      }
    end
    extend Forwardable
    delegate [:to_a, :keys] => :to_hash
    delegate [:include?] => :keys
    def fetch(key, *args)
      hash = to_hash
      verify_key!(hash, key)
      hash.fetch(key, *args)
    end
    def []=(key, value)
      case key
      when :clear
        ::Guard.state.session.clearing(value)
      else
        msg = "Oops! Guard.option[%s]= is unhandled or unsupported." \
          "Please file an issue if you rely on this option working."
        fail NotImplementedError, format(msg, key)
      end
    end
    private
    def verify_key!(hash, key)
      return if hash.key?(key)
      msg = "Oops! Guard.option[%s] is unhandled or unsupported." \
        "Please file an issue if you rely on this option working."
      fail NotImplementedError, format(msg, key)
    end
  end.new
end

def plugin(filter)

def plugin(filter)
  UI.deprecation(PLUGIN)
  ::Guard.state.session.plugins.all(filter).first
end

def plugins(filter)

def plugins(filter)
  UI.deprecation(PLUGINS)
  ::Guard.state.session.plugins.all(filter)
end

def reset_evaluator(_options)

def reset_evaluator(_options)
  UI.deprecation(RESET_EVALUATOR)
end

def runner

def runner
  UI.deprecation(RUNNER)
  ::Guard::Runner.new
end

def running

def running
  UI.deprecation(RUNNING)
  nil
end

def scope

def scope
  UI.deprecation(SCOPE)
  ::Guard.state.scope.to_hash
end

def scope=(scope)

def scope=(scope)
  UI.deprecation(SCOPE_ASSIGN)
  ::Guard.state.scope.from_interactor(scope)
end

def to_hash

def to_hash
  session = ::Guard.state.session
  {
    clear: session.clearing?,
    debug: session.debug?,
    watchdir: Array(session.watchdirs).map(&:to_s),
    notify: session.notify_options[:notify],
    no_interactions: (session.interactor_name == :sleep)
  }
end

def verify_key!(hash, key)

def verify_key!(hash, key)
  return if hash.key?(key)
  msg = "Oops! Guard.option[%s] is unhandled or unsupported." \
    "Please file an issue if you rely on this option working."
  fail NotImplementedError, format(msg, key)
end