Class: Matcher
- Inherits:
-
Object
- Object
- Matcher
- Defined in:
- lib/usagi/matcher.rb
Defined Under Namespace
Classes: MatcherInstance
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(api_value, args) ⇒ Boolean
Constructor Details
#initialize(name, &block) ⇒ Matcher
Returns a new instance of Matcher.
4 5 6 7 |
# File 'lib/usagi/matcher.rb', line 4 def initialize(name, &block) @name = name @matcher = block end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/usagi/matcher.rb', line 2 def name @name end |
Instance Method Details
#matches?(api_value, args) ⇒ Boolean
9 10 11 12 |
# File 'lib/usagi/matcher.rb', line 9 def matches?(api_value, args) mi = MatcherInstance.new(@matcher, api_value, args) raise mi. unless mi.matches? end |