class Guard::Compat::Test::Template::Session
def _watches
def _watches keys = @watches.keys fail ArgumentError, 'no watches!' if keys.empty? fail MultipleGuardNotImplemented if keys.size > 1 key = keys.first fail GlobalWatchesNotImplemented if key.nil? @watches[key] end
def guard(name, _options = {})
def guard(name, _options = {}) @current = name @watches[@current] = [] yield @current = nil end
def initialize(path, content)
def initialize(path, content) @watches = {} @current = nil instance_eval(content, path, 1) end
def match(file)
def match(file) _watches.map do |expr, block| next unless (match = file.match(expr)) block.nil? ? [file] : block.call([file] + match.captures) end.flatten.compact.uniq end
def watch(expr, &block)
def watch(expr, &block) @watches[@current] << [expr, block] end