Class: Spree::Filters::PricePresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/spree/filters/price_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(amount:, currency:) ⇒ PricePresenter

Returns a new instance of PricePresenter.



4
5
6
7
# File 'app/presenters/spree/filters/price_presenter.rb', line 4

def initialize(amount:, currency:)
  @amount = amount.to_i
  @currency = currency
end

Instance Method Details

#to_iObject



9
10
11
# File 'app/presenters/spree/filters/price_presenter.rb', line 9

def to_i
  amount
end

#to_sObject



13
14
15
# File 'app/presenters/spree/filters/price_presenter.rb', line 13

def to_s
  Spree::Money.new(amount, currency: currency, no_cents_if_whole: true).to_s
end