module Guard::UI

def _calling_plugin_name

Returns:
  • (String) - the Guard plugin name

Parameters:
  • depth (Integer) -- the stack depth
def _calling_plugin_name
  name = caller.lazy.map do |line|
    %r{(?<!guard\/lib)\/(guard\/[a-z_]*)(/[a-z_]*)?.rb:}i.match(line)
  end.reject(&:nil?).take(1).force.first
  return "Guard" unless name || (name && name[1] == "guard/lib")
  name[1].split("/").map do |part|
    part.split(/[^a-z0-9]/i).map(&:capitalize).join
  end.join("::")
end