Class: Totes::Query
Defined Under Namespace
Classes: OperationsWrapper
Instance Method Summary collapse
-
#initialize(subject) ⇒ Query
constructor
A new instance of Query.
- #method_missing(name, *args, &block) ⇒ Object
- #must(*args, &block) ⇒ Object
- #wont(*args, &block) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
Instance Method Details
#must(*args, &block) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/totes/query.rb', line 10 def must(*args, &block) if matcher = args[0] __try__ { matcher.test(@subject, fail_on: false) } else OperationsWrapper.new(self, :must) end end |
#wont(*args, &block) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/totes/query.rb', line 18 def wont(*args, &block) if matcher = args[0] __try__ { matcher.test(@subject, fail_on: true) } else OperationsWrapper.new(self, :wont) end end |