Module: PatternMatching::MethodsWithBindingHelper
- Defined in:
- lib/pattern_matching/methods_with_binding_helper.rb
Instance Method Summary collapse
-
#Match(*pattern) ⇒ Object
Wraps a matchable ‘pattern’ in an object that inverts ‘===` (case-equality method).
-
#Pattern(*pattern) ⇒ Object
Wraps an argument list as a pattern for use in a call to #Match.
Instance Method Details
#Match(*pattern) ⇒ Object
Wraps a matchable ‘pattern’ in an object that inverts ‘===` (case-equality method).
6 7 8 9 10 |
# File 'lib/pattern_matching/methods_with_binding_helper.rb', line 6 def Match(*pattern) result = ::PatternMatching::CaseEqualityReversal.new(*pattern) (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label) unless result result end |
#Pattern(*pattern) ⇒ Object
Wraps an argument list as a pattern for use in a call to #Match
14 15 16 17 |
# File 'lib/pattern_matching/methods_with_binding_helper.rb', line 14 def Pattern(*pattern) (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label) ::PatternMatching::PatternMatch.new(*pattern) end |