Class: Mongory::CMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/mongory/c_matcher.rb

Overview

This class is the C extension of Mongory::QueryMatcher. It is used to match records using the C extension.

Examples:

matcher = Mongory::CMatcher.new(condition)
matcher.match?(record) #=> true
# or
collection.mongory.c.where(condition).to_a

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(condition) ⇒ Mongory::CMatcher

Note:

This method is implemented in the C extension

Returns a new matcher.

Parameters:

  • condition (Hash)

    the condition

Returns:



# File 'lib/mongory/c_matcher.rb', line 12

.trace_result_colorful=(colorful) ⇒ void

Note:

This method is implemented in the C extension

This method returns an undefined value.

Parameters:

  • colorful (Boolean)

    whether to enable colorful trace result



# File 'lib/mongory/c_matcher.rb', line 12

Instance Method Details

#conditionHash

Note:

This method is implemented in the C extension

Returns the condition.

Returns:

  • (Hash)

    the condition



# File 'lib/mongory/c_matcher.rb', line 12

#contextUtils::Context

Note:

This method is implemented in the C extension

Returns the context.

Returns:



# File 'lib/mongory/c_matcher.rb', line 12

#disable_tracevoid

Note:

This method will disable trace

Note:

This method is implemented in the C extension

This method returns an undefined value.



# File 'lib/mongory/c_matcher.rb', line 12

#enable_tracevoid

Note:

This method will enable trace

Note:

This method is implemented in the C extension

This method returns an undefined value.



# File 'lib/mongory/c_matcher.rb', line 12

#explainvoid

Note:

This method will print matcher tree structure

Note:

This method is implemented in the C extension

This method returns an undefined value.



# File 'lib/mongory/c_matcher.rb', line 12

#match?(record) ⇒ Boolean

Note:

This method is implemented in the C extension

Returns true if the record matches the condition, false otherwise.

Parameters:

  • record (Object)

    the record to match against

Returns:

  • (Boolean)

    true if the record matches the condition, false otherwise



# File 'lib/mongory/c_matcher.rb', line 12

Note:

This method will print trace result

Note:

This method is implemented in the C extension

This method returns an undefined value.



# File 'lib/mongory/c_matcher.rb', line 12

#to_procProc

Returns a Proc that performs the matching operation.

Returns:

  • (Proc)

    a Proc that performs the matching operation



53
54
55
# File 'lib/mongory/c_matcher.rb', line 53

def to_proc
  Proc.new { |record| match?(record) }
end

#traceBoolean

Note:

This method will print matching process

Note:

This method is implemented in the C extension

Returns true if the record matches the condition, false otherwise.

Returns:

  • (Boolean)

    true if the record matches the condition, false otherwise



# File 'lib/mongory/c_matcher.rb', line 12