Sha256: 5a6dc18659e4de15b1baba6591d8852a143a4b0ee9749d458268738d6f0488c1

Contents?: true

Size: 1013 Bytes

Versions: 27

Compression:

Stored size: 1013 Bytes

Contents

# frozen_string_literal: true
# encoding: utf-8

require "bigdecimal"

module Mongoid
  class Criteria
    module Queryable
      module Extensions

        # The big decimal module adds custom behavior for Origin onto the
        # BigDecimal class.
        module BigDecimal
          module ClassMethods

            # Evolves the big decimal into a MongoDB friendly value - in this case
            # a string.
            #
            # @example Evolve the big decimal
            #   BigDecimal.evolve(decimal)
            #
            # @param [ BigDecimal ] object The object to convert.
            #
            # @return [ String ] The big decimal as a string.
            #
            # @since 1.0.0
            def evolve(object)
              __evolve__(object) do |obj|
                obj ? obj.to_s : obj
              end
            end
          end
        end
      end
    end
  end
end

::BigDecimal.__send__(:extend, Mongoid::Criteria::Queryable::Extensions::BigDecimal::ClassMethods)

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
mongoid-7.3.5 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.3.4 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.1.11 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.2.6 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.3.3 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.3.2 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.2.5 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.1.10 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.1.9 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.2.4 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.3.1 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/mongoid-7.1.7/lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.3.0 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.2.3 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.1.8 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.2.2 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.2.1 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.1.7 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.2.0 lib/mongoid/criteria/queryable/extensions/big_decimal.rb
mongoid-7.1.6 lib/mongoid/criteria/queryable/extensions/big_decimal.rb