Method: Mongory::QueryMatcher#raw_proc

Defined in:
lib/mongory/query_matcher.rb

#raw_procProc

Note:

The proc includes error handling and context-based record conversion

Returns a Proc that can be used for fast matching. The Proc converts the record using Mongory.data_converter and delegates to the superclass's raw_proc.

Returns:

  • (Proc)

    A proc that performs query matching with context awareness



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/mongory/query_matcher.rb', line 52

def raw_proc
  super_proc = super
  need_convert = @context.need_convert
  data_converter = Mongory.data_converter

  Proc.new do |record|
    record = data_converter.convert(record) if need_convert
    super_proc.call(record)
  rescue StandardError
    false
  end
end