Class: CalculationForm

Inherits:
BaseForm show all
Defined in:
app/forms/calculation_form.rb

Overview

A form object for the calculation data, probably coming from the HTTP session but not limited to this usage.

Note that whilst the attributes are defined as being the correct value or :undefined, when exported, any :undefined values are not exported.

Also, note that invalid attributes can contain any value of any type, so if the form is not valid? then do not rely on them being of the correct type.

Constant Summary collapse

UNDEFINED =
:undefined

Instance Attribute Summary collapse

Method Summary

Methods inherited from BaseForm

attribute?, #export, new_ignoring_extras, #type, type, #valid?

Instance Attribute Details

#benefits_receivedArray<String>

Returns Either an array of strings, or :undefined

Returns:

  • (Array<String>)

    Either an array of strings, or :undefined


29
# File 'app/forms/calculation_form.rb', line 29

attribute :benefits_received, :array, default: UNDEFINED

#date_of_birthDate, Symbol

Returns Either a date specifying the date of birth, or :undefined

Returns:

  • (Date, Symbol)

    Either a date specifying the date of birth, or :undefined


17
# File 'app/forms/calculation_form.rb', line 17

attribute :date_of_birth, :date, default: UNDEFINED

#disposable_capitalFloat, Symbol

Returns Either a float value defining the disposable capital, or :undefined

Returns:

  • (Float, Symbol)

    Either a float value defining the disposable capital, or :undefined


26
# File 'app/forms/calculation_form.rb', line 26

attribute :disposable_capital, :float, default: UNDEFINED

#feeFloat, Symbol

Returns Either a float value defining the court fee, or :undefined

Returns:

  • (Float, Symbol)

    Either a float value defining the court fee, or :undefined


23
# File 'app/forms/calculation_form.rb', line 23

attribute :fee, :float, default: UNDEFINED

#marital_statusString, Symbol

Returns Either 'single', 'sharing_income' or :undefined

Returns:

  • (String, Symbol)

    Either 'single', 'sharing_income' or :undefined


14
# File 'app/forms/calculation_form.rb', line 14

attribute :marital_status, :string, default: UNDEFINED

#number_of_childrenFixnum, Symbol

Returns Either an integer value defining the number of children, or :undefined

Returns:

  • (Fixnum, Symbol)

    Either an integer value defining the number of children, or :undefined


32
# File 'app/forms/calculation_form.rb', line 32

attribute :number_of_children, :integer, default: UNDEFINED

#partner_date_of_birthDate, ...

Returns Either a date specifying the partner's date of birth, nil (if no partner), or :undefined

Returns:

  • (Date, Symbol, nil)

    Either a date specifying the partner's date of birth, nil (if no partner), or :undefined


20
# File 'app/forms/calculation_form.rb', line 20

attribute :partner_date_of_birth, :date, default: UNDEFINED

#total_incomeFloat, Symbol

Returns Either a float value defining the total income, or :undefined

Returns:

  • (Float, Symbol)

    Either a float value defining the total income, or :undefined


35
# File 'app/forms/calculation_form.rb', line 35

attribute :total_income, :float, default: UNDEFINED