Sha256: 63a8bf8decadb4741315eb6c365082d0601d3a321122e9668b370a902f4ce231

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

module PatternMatching
  module MethodsWithBindingHelper

    ##
    # Wraps a matchable 'pattern' in an object that inverts `===` (case-equality method).
    def Match(*pattern)
      result = ::PatternMatching::CaseEqualityReversal.new(*pattern)
      (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label) unless result
      result
    end

    ##
    # Wraps an argument list as a pattern for use in a call to #Match
    def Pattern(*pattern)
      (self.class)::B._clear_bindings!(caller_locations(1,1)[0].label)
      ::PatternMatching::PatternMatch.new(*pattern)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pattern_matching-0.1.0 lib/pattern_matching/methods_with_binding_helper.rb