Early initialization has advantages too :-)

I think in this case it is fine, just few more CPU ticks here.

Thanks!
 
On Tue, Jul 16, 2013 at 01:18:01AM -0700, Dmitri Dolguikh wrote:
> > @@ -1,7 +1,9 @@
> >  require 'yaml'
> >  root     = File.expand_path(File.dirname(__FILE__) + "/..")
> >  SETTINGS = YAML.load_file("#{root}/config/settings.yaml")
> > -SETTINGS[:version]    = File.read(root + "/VERSION").chomp rescue ("N/A")
> > +SETTINGS[:version]    = File.read(root + "/VERSION").chomp
> > +SETTINGS[:version_major], SETTINGS[:version_minor], SETTINGS[:version_build] = SETTINGS[:version].scan(/\d+/)
> > +SETTINGS[:version_major_minor] = SETTINGS[:version_major] + '.' + SETTINGS[:version_minor]
> >  SETTINGS[:unattended] = SETTINGS[:unattended].nil? || SETTINGS[:unattended]
> 
> I like this waaay better :). Personally though, I wouldn't read and parse the file in the constructor (b/c of various side effects), but rather do that lazily. 
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/theforeman/foreman/pull/774/files#r5210481

-- 
Later,

 Lukas "lzap" Zapletal
 irc: lzap #theforeman