dwhelan/proc_extensions

View on GitHub
lib/core_extensions/proc/match.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ProcExtensions
  module Match
    def self.included(base)
      base.class_eval do
        # rubocop:disable Lint/NestedMethodDefinition
        def match(other)
          ProcSource.new(other) == ProcSource.new(self)
        end

        alias_method :=~, :match
      end
    end
  end
end