Class: LookLike::Matchers
- Inherits:
-
Object
- Object
- LookLike::Matchers
- Defined in:
- lib/look_like/matchers.rb
Constant Summary collapse
- @@matchers =
[]
Class Method Summary collapse
- .define(config) ⇒ Object
- .error(actual, expected) ⇒ Object
- .find(expected) ⇒ Object
- .match(actual, expected) ⇒ Object
- .negate_error(actual, expected) ⇒ Object
Class Method Details
.define(config) ⇒ Object
5 6 7 |
# File 'lib/look_like/matchers.rb', line 5 def self.define(config) @@matchers.unshift(LookLike::Matcher.new(config)) end |
.error(actual, expected) ⇒ Object
18 19 20 |
# File 'lib/look_like/matchers.rb', line 18 def self.error(actual, expected) find(expected).error(actual, expected) end |
.find(expected) ⇒ Object
9 10 11 12 |
# File 'lib/look_like/matchers.rb', line 9 def self.find(expected) matchers = [LookLike::NestedArrayMatcher.new(@@matchers), LookLike::ArrayMatcher.new(@@matchers)] + @@matchers matchers.find { |matcher| matcher.select(expected) } end |
.match(actual, expected) ⇒ Object
14 15 16 |
# File 'lib/look_like/matchers.rb', line 14 def self.match(actual, expected) find(expected).match(actual, expected) end |
.negate_error(actual, expected) ⇒ Object
22 23 24 |
# File 'lib/look_like/matchers.rb', line 22 def self.negate_error(actual, expected) find(expected).negate_error(actual, expected) end |