Class: Spree::Price
Constant Summary
collapse
- MAXIMUM_AMOUNT =
BigDecimal("99_999_999.99")
Instance Method Summary
collapse
money_methods
Methods inherited from Base
display_includes
#generate_permalink, #save_permalink
Instance Method Details
#country_iso=(country_iso) ⇒ Object
65
66
67
|
# File 'app/models/spree/price.rb', line 65
def country_iso=(country_iso)
self[:country_iso] = country_iso.presence
end
|
#display_country ⇒ Object
57
58
59
60
61
62
63
|
# File 'app/models/spree/price.rb', line 57
def display_country
if country_iso
"#{country_iso} (#{I18n.t(country_iso, scope: [:spree, :country_names])})"
else
I18n.t(:any_country, scope: [:spree, :admin, :prices])
end
end
|
#for_any_country? ⇒ Boolean
53
54
55
|
# File 'app/models/spree/price.rb', line 53
def for_any_country?
country_iso.nil?
end
|
#net_amount ⇒ Object
49
50
51
|
# File 'app/models/spree/price.rb', line 49
def net_amount
amount / (1 + sum_of_vat_amounts)
end
|
#price ⇒ Object
37
38
39
|
# File 'app/models/spree/price.rb', line 37
def price
amount
end
|
#price=(price) ⇒ Object
Sets this price’s amount to a new value, parsing it if the new value is a string.
45
46
47
|
# File 'app/models/spree/price.rb', line 45
def price=(price)
self[:amount] = Spree::LocalizedNumber.parse(price)
end
|