Module: Tramway::Core::ApplicationForms::PropertiesObjectHelper

Included in:
Tramway::Core::ApplicationForm
Defined in:
app/forms/tramway/core/application_forms/properties_object_helper.rb

Instance Method Summary collapse

Instance Method Details

#form_properties(**args) ⇒ Object



4
5
6
# File 'app/forms/tramway/core/application_forms/properties_object_helper.rb', line 4

def form_properties(**args)
  @form_properties = args
end

#form_properties_additional(**args) ⇒ Object



8
9
10
# File 'app/forms/tramway/core/application_forms/properties_object_helper.rb', line 8

def form_properties_additional(**args)
  @form_properties_additional = args
end

#propertiesObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/forms/tramway/core/application_forms/properties_object_helper.rb', line 12

def properties
  return @form_properties if @form_properties

  yaml_config_file_path = Rails.root.join('app', 'forms', "#{self.class.name.underscore}.yml")

  return [] unless File.exist? yaml_config_file_path

  @form_properties = YAML.load_file(yaml_config_file_path).deep_symbolize_keys
  @form_properties.deep_merge! @form_properties_additional if @form_properties_additional
  @form_properties
end