ywen/model_presenter

View on GitHub
lib/model_presenter/money.rb

Summary

Maintainability
A
0 mins
Test Coverage
module ModelPresenter
  class Money
    attr_reader :amount_in_cents

    def initialize(amount_in_cents)
      @amount_in_cents = amount_in_cents
    end

    def to_dollar
      amount_in_dollar = amount_in_cents.to_f / 100
      '%.2f' % amount_in_dollar
    end
  end
end