Class: Guard::Watcher::Pattern

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/watcher/pattern.rb,
lib/guard/watcher/pattern/matcher.rb,
lib/guard/watcher/pattern/simple_path.rb,
lib/guard/watcher/pattern/match_result.rb,
lib/guard/watcher/pattern/pathname_path.rb,
lib/guard/watcher/pattern/deprecated_regexp.rb

Defined Under Namespace

Classes: DeprecatedRegexp, MatchResult, Matcher, PathnamePath, SimplePath

Class Method Summary collapse

Class Method Details

.create(pattern) ⇒ Object


12
13
14
15
16
17
18
19
20
21
# File 'lib/guard/watcher/pattern.rb', line 12

def self.create(pattern)
  if DeprecatedRegexp.new(pattern).deprecated?
    DeprecatedRegexp.show_deprecation(pattern)
    return DeprecatedRegexp.convert(pattern)
  end

  return PathnamePath.new(pattern) if pattern.is_a?(Pathname)
  return SimplePath.new(pattern) if pattern.is_a?(String)
  Matcher.new(pattern)
end