Method: Resque::Plugin#lint

Defined in:
lib/resque/plugin.rb

#lint(plugin) ⇒ Object

Ensure that your plugin conforms to good hook naming conventions.

Resque::Plugin.lint(MyResquePlugin)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/resque/plugin.rb', line 10

def lint(plugin)
  hooks = before_hooks(plugin) + around_hooks(plugin) + after_hooks(plugin)

  hooks.each do |hook|
    if hook =~ /perform$/
      raise LintError, "#{plugin}.#{hook} is not namespaced"
    end
  end

  failure_hooks(plugin).each do |hook|
    if hook =~ /failure$/
      raise LintError, "#{plugin}.#{hook} is not namespaced"
    end
  end
end