Class: Spritpreisrechner::PaymentMethod

Inherits:
Object
  • Object
show all
Defined in:
lib/spritpreisrechner/payment_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cashObject (readonly)

Returns the value of attribute cash.



3
4
5
# File 'lib/spritpreisrechner/payment_method.rb', line 3

def cash
  @cash
end

#credit_cardObject (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_cardObject (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

#othersObject (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

Returns:

  • (Boolean)


12
13
14
# File 'lib/spritpreisrechner/payment_method.rb', line 12

def cash?
  @cash == true
end

#credit_card?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/spritpreisrechner/payment_method.rb', line 20

def credit_card?
  @debit_card == true
end

#debit_card?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/spritpreisrechner/payment_method.rb', line 16

def debit_card?
  @debit_card == true
end