Class: Workarea::Pricing::Price
- Inherits:
-
Object
- Object
- Workarea::Pricing::Price
- Includes:
- ApplicationDocument, UnsupportedSegmentation, Releasable
- Defined in:
- app/models/workarea/pricing/price.rb
Instance Method Summary collapse
- #generic? ⇒ Boolean
- #name ⇒ Object
-
#on_sale? ⇒ Boolean
Whether this price is on sale.
- #sell ⇒ Object
Methods included from Releasable
#changesets_with_children, #destroy, #in_release, #release_changes, #release_originals, #save_changeset, #skip_changeset, #without_release
Methods included from Segmentable
#active?, #active_segment_ids_with_children, #segmented?, #segments
Methods included from Release::Activation
#activate_with?, #create_activation_changeset, #save_activate_with, #was_active?
Methods included from ApplicationDocument
Methods included from Sidekiq::Callbacks
assert_valid_config!, async, disable, enable, inline, #run_callbacks
Methods included from Mongoid::Document
Instance Method Details
#generic? ⇒ Boolean
31 32 33 |
# File 'app/models/workarea/pricing/price.rb', line 31 def generic? min_quantity == 1 end |
#name ⇒ Object
19 20 21 |
# File 'app/models/workarea/pricing/price.rb', line 19 def name '' end |
#on_sale? ⇒ Boolean
Whether this price is on sale. Defaults to the #on_sale
value of the Pricing::Sku
it’s embedded within.
40 41 42 |
# File 'app/models/workarea/pricing/price.rb', line 40 def on_sale? super || sku&.on_sale? end |
#sell ⇒ Object
23 24 25 26 27 28 29 |
# File 'app/models/workarea/pricing/price.rb', line 23 def sell if on_sale? && sale.present? sale else regular end end |