newbie here.
I'm trying to simplify this and I'm wondering If a ternary statement should be the way to go. Also, I guess I should not repeat "PaymentAccount.new". As I try to convert it into a ternary statement I keep getting errors.
def initialize(document_data)
document_data.payment_accounts =
if document_data.compensation_currency == 'EUR'
[
PaymentAccount.new(
currency: 'EUR',
bank_name: 'bank name',
iban: 'EU000000000000001',
swift: 'EURBANK'
)
]
else
[
PaymentAccount.new(
bank_name: 'bank name 2',
iban: 'NT00000000000000',
swift: 'NTBANK'
)
]
end
super(document_data)
end