Class: SolidusVolumePricing::PriceDisplay

Inherits:
Object
  • Object
show all
Defined in:
app/models/solidus_volume_pricing/price_display.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(variant, quantity: 1, user: nil) ⇒ PriceDisplay

Returns a new instance of PriceDisplay.



7
8
9
10
11
# File 'app/models/solidus_volume_pricing/price_display.rb', line 7

def initialize(variant, quantity: 1, user: nil)
  @variant = variant
  @quantity = quantity
  @user = user
end

Instance Attribute Details

#quantityObject (readonly)

Returns the value of attribute quantity.



5
6
7
# File 'app/models/solidus_volume_pricing/price_display.rb', line 5

def quantity
  @quantity
end

#userObject (readonly)

Returns the value of attribute user.



5
6
7
# File 'app/models/solidus_volume_pricing/price_display.rb', line 5

def user
  @user
end

#variantObject (readonly)

Returns the value of attribute variant.



5
6
7
# File 'app/models/solidus_volume_pricing/price_display.rb', line 5

def variant
  @variant
end

Instance Method Details

#earning_amount_stringObject



17
18
19
# File 'app/models/solidus_volume_pricing/price_display.rb', line 17

def earning_amount_string
  earning_amount.to_s
end

#earning_percent_stringObject



21
22
23
# File 'app/models/solidus_volume_pricing/price_display.rb', line 21

def earning_percent_string
  earning_percent.to_s
end

#price_stringObject



13
14
15
# File 'app/models/solidus_volume_pricing/price_display.rb', line 13

def price_string
  price.to_s
end