Class: LookLike::Matcher
- Inherits:
-
Object
- Object
- LookLike::Matcher
- Defined in:
- lib/look_like/matcher.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#error(actual, expected) ⇒ Object
Returns the value of attribute error.
-
#match(actual, expected) ⇒ Object
Returns the value of attribute match.
-
#name ⇒ Object
Returns the value of attribute name.
-
#select(expected) ⇒ Object
Returns the value of attribute select.
Instance Method Summary collapse
-
#initialize(config) ⇒ Matcher
constructor
A new instance of Matcher.
- #negate_error(actual, expected) ⇒ Object
Constructor Details
#initialize(config) ⇒ Matcher
Returns a new instance of Matcher.
9 10 11 12 13 14 |
# File 'lib/look_like/matcher.rb', line 9 def initialize(config) @name = config[:name] @desc = config[:desc] @selector = config[:select] @matcher = config[:match] end |
Instance Attribute Details
#desc ⇒ Object
Returns the value of attribute desc.
4 5 6 |
# File 'lib/look_like/matcher.rb', line 4 def desc @desc end |
#error(actual, expected) ⇒ Object
Returns the value of attribute error.
7 8 9 |
# File 'lib/look_like/matcher.rb', line 7 def error @error end |
#match(actual, expected) ⇒ Object
Returns the value of attribute match.
6 7 8 |
# File 'lib/look_like/matcher.rb', line 6 def match @match end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/look_like/matcher.rb', line 3 def name @name end |
#select(expected) ⇒ Object
Returns the value of attribute select.
5 6 7 |
# File 'lib/look_like/matcher.rb', line 5 def select @select end |
Instance Method Details
#negate_error(actual, expected) ⇒ Object
20 21 22 |
# File 'lib/look_like/matcher.rb', line 20 def negate_error(actual, expected) "Did not expect :\"#{actual}\" to look like : \"#{expected}\" (#{@desc})" end |