Class: Spritpreisrechner::PaymentMethod
- Inherits:
-
Object
- Object
- Spritpreisrechner::PaymentMethod
- Defined in:
- lib/spritpreisrechner/payment_method.rb
Instance Attribute Summary collapse
-
#cash ⇒ Object
readonly
Returns the value of attribute cash.
-
#credit_card ⇒ Object
readonly
Returns the value of attribute credit_card.
-
#debit_card ⇒ Object
readonly
Returns the value of attribute debit_card.
-
#others ⇒ Object
readonly
Returns the value of attribute others.
Instance Method Summary collapse
- #cash? ⇒ Boolean
- #credit_card? ⇒ Boolean
- #debit_card? ⇒ Boolean
-
#initialize(payment_method) ⇒ PaymentMethod
constructor
A new instance of PaymentMethod.
Constructor Details
#initialize(payment_method) ⇒ PaymentMethod
Returns a new instance of PaymentMethod.
5 6 7 8 9 10 |
# File 'lib/spritpreisrechner/payment_method.rb', line 5 def initialize(payment_method) @cash = payment_method[:cash] @debit_card = payment_method[:debitCard] @credit_card = payment_method[:creditCard] @others = payment_method[:others]&.split(', ') end |
Instance Attribute Details
#cash ⇒ Object (readonly)
Returns the value of attribute cash.
3 4 5 |
# File 'lib/spritpreisrechner/payment_method.rb', line 3 def cash @cash end |
#credit_card ⇒ Object (readonly)
Returns the value of attribute credit_card.
3 4 5 |
# File 'lib/spritpreisrechner/payment_method.rb', line 3 def credit_card @credit_card end |
#debit_card ⇒ Object (readonly)
Returns the value of attribute debit_card.
3 4 5 |
# File 'lib/spritpreisrechner/payment_method.rb', line 3 def debit_card @debit_card end |
#others ⇒ Object (readonly)
Returns the value of attribute others.
3 4 5 |
# File 'lib/spritpreisrechner/payment_method.rb', line 3 def others @others end |
Instance Method Details
#cash? ⇒ Boolean
12 13 14 |
# File 'lib/spritpreisrechner/payment_method.rb', line 12 def cash? @cash == true end |
#credit_card? ⇒ Boolean
20 21 22 |
# File 'lib/spritpreisrechner/payment_method.rb', line 20 def credit_card? @debit_card == true end |
#debit_card? ⇒ Boolean
16 17 18 |
# File 'lib/spritpreisrechner/payment_method.rb', line 16 def debit_card? @debit_card == true end |