class Guard::Internals::Scope

def _hashify_scope(type)

TODO: why even instantiate?? just to check if it exists?
TODO: let the Plugins and Groups classes handle this?
def _hashify_scope(type)
  # TODO: get cmdline passed to initialize above?
  cmdline = Array(Guard.state.session.send("cmdline_#{type}s"))
  guardfile = Guard.state.session.send(:"guardfile_#{type}_scope")
  interactor = instance_variable_get(:"@interactor_#{type}_scope")
  # TODO: session should decide whether to use cmdline or guardfile -
  # since it has access to both variables
  items = [interactor, cmdline, guardfile].detect do |source|
    !source.empty?
  end
  # TODO: not tested when groups/plugins given don't exist
  # TODO: should already be instantiated
  Array(items).map do |obj|
    if obj.respond_to?(:name)
      obj
    else
      name = obj
      (type == :group ? _groups : _plugins).all(name).first
    end
  end.compact
end