Class: PolishInvoicer::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/polish_invoicer/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(invoice) ⇒ Validator



7
8
9
10
# File 'lib/polish_invoicer/validator.rb', line 7

def initialize(invoice)
  @invoice = invoice
  @errors = {}
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/polish_invoicer/validator.rb', line 5

def errors
  @errors
end

Instance Method Details

#valid?Boolean



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/polish_invoicer/validator.rb', line 12

def valid?
  @errors = {}
  check_presence
  check_not_nil
  check_dates
  check_arrays
  check_booleans
  check_price
  check_price_paid
  check_vat
  check_proforma
  check_create_and_payment_date
  check_currency
  check_lang
  @errors.empty?
end