Class: Pokotarou::RegistrationConfigMaker::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/pokotarou/registration_config_maker/main.rb

Class Method Summary collapse

Class Method Details

.gen(filepath) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pokotarou/registration_config_maker/main.rb', line 15

def gen filepath
  all_content = YAML.load_file(filepath).deep_symbolize_keys!
  AdditionalVariables::Main.set_const(all_content)
  set_header_config(all_content)
  all_content.reduce({}) do |acc, block_content|

    block_name = block_content.first
    block_config = block_content.second
  
    if ConfigDomain.is_dush_syntax?(block_name.to_s)
      acc[block_name] = block_config
    else
      set_model_config_to_acc(acc, block_content)
    end
  
    acc
    
  end
end