Skip to content

Commit

Permalink
Added ability to load configuration file contents from the config obj…
Browse files Browse the repository at this point in the history
…ect (so you don't have to be aware that Halcyon::Config::File even exists).
  • Loading branch information
mtodd committed Jun 20, 2008
1 parent a912bff commit 2699c59
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/halcyon/config.rb
Expand Up @@ -175,6 +175,14 @@ def defaults(env = nil)
Halcyon::Config.defaults(env)
end

# Loads the contents of a configuration file found at <tt>path</tt> and
# merges it with the current configuration.
#
def load_from(path)
self.configure(Halcyon::Config::File.load(path))
self
end

def inspect
attrs = ""
self.config.keys.each {|key| attrs << " #{key}=#{self.config[key].inspect}"}
Expand Down Expand Up @@ -231,6 +239,12 @@ def defaults(env = nil)
end
end

# Loads the contents of a configuration file found at <tt>path</tt>.
#
def load_from(path)
Halcyon::Config::File.load(path)
end

end

end
Expand Down

0 comments on commit 2699c59

Please sign in to comment.