def plugin_class(options = {})
      options = { fail_gracefully: false }.merge(options)

      const = _plugin_constant
      fail TypeError, "no constant: #{_constant_name}" unless const
      @plugin_class ||= Guard.const_get(const)

    rescue TypeError
      begin
        require "guard/#{ name.downcase }"
        const = _plugin_constant
        @plugin_class ||= Guard.const_get(const)

      rescue TypeError => error
        UI.error "Could not find class Guard::#{ _constant_name }"
        UI.error error.backtrace.join("\n")
        # TODO: return value or move exception higher
      rescue LoadError => error
        unless options[:fail_gracefully]
          msg = format(ERROR_NO_GUARD_OR_CLASS, name.downcase, _constant_name)
          UI.error(msg)
          UI.error("Error is: #{error}")
          UI.error(error.backtrace.join("\n"))
          # TODO: return value or move exception higher
        end
      end
    end
def plugin_class(options = {})
      options = { fail_gracefully: false }.merge(options)

      const = _plugin_constant
      fail TypeError, "no constant: #{_constant_name}" unless const
      @plugin_class ||= Guard.const_get(const)

    rescue TypeError
      begin
        require "guard/#{ name.downcase }"
        const = _plugin_constant
        @plugin_class ||= Guard.const_get(const)

      rescue TypeError => error
        UI.error "Could not find class Guard::#{ _constant_name }"
        UI.error error.backtrace.join("\n")
        # TODO: return value or move exception higher
      rescue LoadError => error
        unless options[:fail_gracefully]
          msg = format(ERROR_NO_GUARD_OR_CLASS, name.downcase, _constant_name)
          UI.error(msg)
          UI.error("Error is: #{error}")
          UI.error(error.backtrace.join("\n"))
          # TODO: return value or move exception higher
        end
      end
    end
Tries to load the Guard plugin main class. This transforms the supplied
 plugin name into a class name:

 * `guardname` will become `Guard::Guardname`
 * `dashed-guard-name` will become `Guard::DashedGuardName`
 * `underscore_guard_name` will become `Guard::UnderscoreGuardName`

 When no class is found with the strict case sensitive rules, another
 try is made to locate the class without matching case:

 * `rspec` will find a class `Guard::RSpec`

 @option options [Boolean] fail_gracefully whether error messages should
 not be printed

 @return [Class, nil] the loaded class