Class: Spree::Price
- Extended by:
- DisplayMoney
- Defined in:
- app/models/spree/price.rb
Constant Summary collapse
- MAXIMUM_AMOUNT =
BigDecimal('99_999_999.99')
Instance Method Summary collapse
- #display_country ⇒ Object
- #for_any_country? ⇒ Boolean
- #net_amount ⇒ Object
-
#price ⇒ Object
An alias for #amount.
-
#price=(price) ⇒ Object
Sets this price’s amount to a new value, parsing it if the new value is a string.
Methods included from DisplayMoney
Methods inherited from Base
display_includes, #initialize_preference_defaults, page, preference
Methods included from Spree::Preferences::Preferable
#default_preferences, #defined_preferences, #get_preference, #has_preference!, #has_preference?, #preference_default, #preference_type, #set_preference
Instance Method Details
#display_country ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/models/spree/price.rb', line 53 def display_country if country_iso "#{country_iso} (#{country.name})" else I18n.t(:any_country, scope: [:spree, :admin, :prices]) end end |
#for_any_country? ⇒ Boolean
49 50 51 |
# File 'app/models/spree/price.rb', line 49 def for_any_country? country_iso.nil? end |
#net_amount ⇒ Object
45 46 47 |
# File 'app/models/spree/price.rb', line 45 def net_amount amount / (1 + sum_of_vat_amounts) end |
#price ⇒ Object
An alias for #amount
33 34 35 |
# File 'app/models/spree/price.rb', line 33 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.
41 42 43 |
# File 'app/models/spree/price.rb', line 41 def price=(price) self[:amount] = Spree::LocalizedNumber.parse(price) end |