<commit_before>require 'origin-selectable_ext'

module Mongoize
  extend ActiveSupport::Concern
  # See http://mongoid.org/en/mongoid/docs/upgrading.html        

  def mongoize
    {'cents' => cents, 'currency_iso' => currency.iso_code}
  end

  module ClassMethods
    def demongoize(value)
      value && ::Money.new( get_cents(value), get_currency(value) )
    end

    def evolve(object)
      object.__evolve_to_money__.mongoize
    end

    def custom_serialization?(operator)
      return false unless operator
      case operator
        when "$gte", "$gt", "$lt", "$lte"
          true
      else
        false
      end
    end

    def custom_specify(name, operator, value, options = {})
      money = value.__evolve_to_money__<commit_msg>Support nil queries for amount.<commit_after>require 'origin-selectable_ext'

module Mongoize
  extend ActiveSupport::Concern
  # See http://mongoid.org/en/mongoid/docs/upgrading.html        

  def mongoize
    {'cents' => cents, 'currency_iso' => currency.iso_code}
  end

  module ClassMethods
    def demongoize(value)
      value && ::Money.new( get_cents(value), get_currency(value) )
    end

    def evolve(object)
      object && object.__evolve_to_money__.mongoize
    end

    def custom_serialization?(operator)
      return false unless operator
      case operator
        when "$gte", "$gt", "$lt", "$lte"
          true
      else
        false
      end
    end

    def custom_specify(name, operator, value, options = {})
      money = value.__evolve_to_money__
{'fraction_non_alphanumeric': 0.10130718954248366, 'fraction_numerical': 0.0, 'mean_word_length': 2.7896039603960396, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5911601', 'n_tokens_mistral': 487, 'n_tokens_neox': 466, 'n_words': 110}