Class: Core::Watch::Callbacks::Regexp

Inherits:
Core::Watch::Callback show all
Defined in:
lib/core/watch/callbacks/regexp.rb

Overview

public

Callback that wraps a regular expression.

Instance Method Summary collapse

Methods inherited from Core::Watch::Callback

build, #call

Constructor Details

#initialize(regexp, **kwargs, &block) ⇒ Regexp

Returns a new instance of Regexp.



9
10
11
12
13
# File 'lib/core/watch/callbacks/regexp.rb', line 9

def initialize(regexp, **kwargs, &block)
  super(**kwargs, &block)

  @regexp = regexp
end

Instance Method Details

#match?(path) ⇒ Boolean

public

Return ‘true` if this callback matches the path.

Returns:

  • (Boolean)


17
18
19
# File 'lib/core/watch/callbacks/regexp.rb', line 17

def match?(path)
  @regexp.match?(path.to_s)
end