Class: Watirmark::Matcher

Inherits:
Object show all
Defined in:
lib/watirmark/controller/matcher.rb

Constant Summary collapse

@@matchers =
{}

Class Method Summary collapse

Class Method Details

.add_matcher(name, &block) ⇒ Object



6
7
8
# File 'lib/watirmark/controller/matcher.rb', line 6

def add_matcher(name, &block)
  @@matchers[name] = block
end

.exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/watirmark/controller/matcher.rb', line 10

def exists?(name)
  @@matchers.has_key?(name)
end

.matches?(element, expected, actual) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/watirmark/controller/matcher.rb', line 14

def matches?(element, expected, actual)
  instance_exec(element, actual, &@@matchers[expected])
end