Class: Ixtlan::Configurator
- Inherits:
-
Object
- Object
- Ixtlan::Configurator
- Defined in:
- lib/generators/ixtlan/setup/templates/preinitializer.rb
Class Method Summary collapse
Class Method Details
.load(file) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/generators/ixtlan/setup/templates/preinitializer.rb', line 21 def self.load(file) if File.exists?(file) symbolize_keys(YAML::load(ERB.new(IO.read(file)).result)) else warn "no file #{file} to load - maybe the is a #{file}.example" end end |
.symbolize_keys(h) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/generators/ixtlan/setup/templates/preinitializer.rb', line 6 def self.symbolize_keys(h) result = {} h.each do |k, v| v = ' ' if v.nil? if v.is_a?(Hash) result[k.to_sym] = symbolize_keys(v) unless v.size == 0 else result[k.to_sym] = v unless k.to_sym == v.to_sym end end result end |