lib/polish_invoicer/presenter.rb in polish_invoicer-0.0.26 vs lib/polish_invoicer/presenter.rb in polish_invoicer-0.0.28
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module PolishInvoicer
class Presenter
attr_accessor :invoice
def initialize(invoice)
@@ -38,18 +40,20 @@
def format_dates
%w[trade_date create_date payment_date].each do |field|
v = @invoice.send(field)
next unless v
+
@out[field.to_sym] = v.strftime '%d.%m.%Y'
end
end
def format_prices
%w[net_value vat_value gross_value exchanged_tax total_to_pay_value paid_value to_pay_value].each do |field|
v = @invoice.send(field)
next unless v
- @out[field.to_sym] = sprintf('%02.2f', v).tr('.', ',')
+
+ @out[field.to_sym] = format('%02.2f', v).tr('.', ',')
end
end
def format_comments
@out[:comments] = [@invoice.comments].flatten.compact