Class: EnumStyle::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/enum_style/railtie.rb

Instance Method Summary collapse

Instance Method Details

#preloadObject



4
5
6
7
8
9
10
# File 'lib/enum_style/railtie.rb', line 4

def preload

  file_path = ::Rails.root.join('config', 'enum_style.yml')
  result = File.exist?(file_path) ? YAML.load(ERB.new(IO.read(file_path))).result : {}

  Kernel.const_set('EnumStyles', result)
end