Class: Addressing::AddressFormatHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/addressing/address_format.rb

Class Method Summary collapse

Class Method Details

.required_fields(address_format, field_overrides) ⇒ Object

Gets the required fields.

Applies field overrides to the required fields specified by the address format.



154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/addressing/address_format.rb', line 154

def required_fields(address_format, field_overrides)
  required_fields = address_format.required_fields
  required_fields -= field_overrides.optional_fields
  required_fields -= field_overrides.hidden_fields

  if field_overrides.required_fields
    required_fields += field_overrides.required_fields
    required_fields = required_fields.uniq
  end

  required_fields
end