Class: Totes::Matcher::BeAnything
- Inherits:
-
Totes::Matcher
- Object
- Totes::Matcher
- Totes::Matcher::BeAnything
- Defined in:
- lib/totes/matcher/be_anything.rb
Constant Summary
Constants inherited from Totes::Matcher
Instance Method Summary collapse
-
#initialize(method_name, *args, &block) ⇒ BeAnything
constructor
A new instance of BeAnything.
- #likes(subject) ⇒ Object
Methods inherited from Totes::Matcher
build, error_must, error_wont, #test
Constructor Details
#initialize(method_name, *args, &block) ⇒ BeAnything
Returns a new instance of BeAnything.
6 7 8 9 10 |
# File 'lib/totes/matcher/be_anything.rb', line 6 def initialize(method_name, *args, &block) @method = method_name =~ /\?$/ ? method_name : "#{method_name}?" @args = args @block = block end |
Instance Method Details
#likes(subject) ⇒ Object
12 13 14 |
# File 'lib/totes/matcher/be_anything.rb', line 12 def likes(subject) @result = subject.__send__ @method, *@args, &@block end |