Module: Mongory::Converters::Converted

Included in:
Array, Hash
Defined in:
lib/mongory/converters/converted.rb

Overview

Converted is a module that provides conversion structures marked as Converted. It is used to convert various types of data into a standardized form for MongoDB queries. The module includes classes for converting hashes and arrays into nested structures. It is used internally by the ConditionConverter and ValueConverter to handle the conversion of complex data types into a format suitable for MongoDB queries.

Defined Under Namespace

Classes: Array, Hash

Instance Method Summary collapse

Instance Method Details

#instance_convert(other) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/mongory/converters/converted.rb', line 13

def instance_convert(other)
  return other if other.is_a?(Converted)

  case other
  when ::Hash
    Converted::Hash.new(other)
  when ::Array
    Converted::Array.new(other)
  else
    other
  end
end