Sha256: 8e8e78a07fc0516f4d4a70f8146fd94266517e9467419a100a9b3248ee71ac7c

Contents?: true

Size: 415 Bytes

Versions: 10

Compression:

Stored size: 415 Bytes

Contents

# Really simple money class for testing
class Money

  attr_accessor :cents, :currency

  def initialize(cents, currency = nil)
    self.cents = cents.to_i
    self.currency = currency
  end

  def to_s
    (self.cents.to_f / 100).to_s
  end

  def self.couchrest_typecast(parent, property, value)
    if parent.respond_to?(:currency)
      new(value, parent.currency)
    else
      new(value)
    end
  end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
couchrest_model-2.2.0.beta2 spec/fixtures/models/money.rb
couchrest_model-2.2.0.beta1 spec/fixtures/models/money.rb
couchrest_model-2.1.0.rc1 spec/fixtures/models/money.rb
couchrest_model-2.1.0.beta2 spec/fixtures/models/money.rb
couchrest_model-2.1.0.beta1 spec/fixtures/models/money.rb
couchrest_model-2.0.4 spec/fixtures/models/money.rb
couchrest_model-2.0.3 spec/fixtures/models/money.rb
couchrest_model-2.0.1 spec/fixtures/models/money.rb
couchrest_model-2.0.0 spec/fixtures/models/money.rb
couchrest_model-2.0.0.beta2 spec/fixtures/models/money.rb