Skip to content

Instantly share code, notes, and snippets.

@anlek
Created January 6, 2011 16:24
Show Gist options
  • Save anlek/768112 to your computer and use it in GitHub Desktop.
Save anlek/768112 to your computer and use it in GitHub Desktop.
external.config
c = Configuration.new
c.instance_eval(File.read('config_file.rb'))
sql_connection do
host "127.0.0.1"
end
class Configuration
def sql_connection
@sql_connection = SqlConnection.new
@sql_connection.instance_exec(Proc.new) if block_given?
end
end
class SqlConnection
def host(value=nil)
@host = value if value
@host
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment