Sha256: 3eb8c13b8455dcc7929af8c55307da13fb8d0b7646016f57fa680db491616447

Contents?: true

Size: 461 Bytes

Versions: 28

Compression:

Stored size: 461 Bytes

Contents

class Money
  module BlankMongoizing
    def mongoize(value)
      return nil if value.blank?
      super(value)
    end
  end

  class << self
    prepend BlankMongoizing
  end

  alias_method :to_m, :to_money

  def as_json(*)
    Money.mongoize(self)
  end

  def to_json(*)
    as_json.to_json
  end
end

class Numeric
  alias_method :to_m, :to_money
end

class String
  alias_method :to_m, :to_money
end

class NilClass
  alias_method :to_m, :to_money
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
workarea-core-3.5.6 lib/workarea/ext/freedom_patches/money.rb
workarea-core-3.5.5 lib/workarea/ext/freedom_patches/money.rb
workarea-core-3.5.4 lib/workarea/ext/freedom_patches/money.rb
workarea-core-3.5.3 lib/workarea/ext/freedom_patches/money.rb
workarea-core-3.5.2 lib/workarea/ext/freedom_patches/money.rb
workarea-core-3.5.1 lib/workarea/ext/freedom_patches/money.rb
workarea-core-3.5.0 lib/workarea/ext/freedom_patches/money.rb
workarea-core-3.5.0.beta.1 lib/workarea/ext/freedom_patches/money.rb