Skip to content

Instantly share code, notes, and snippets.

@bussiere
Created August 10, 2010 12:58
Show Gist options
  • Save bussiere/517221 to your computer and use it in GitHub Desktop.
Save bussiere/517221 to your computer and use it in GitHub Desktop.
#getting all the variable of a ruby file in a hash
result = Hash.new
file = File.new("betageneration.rb", "r")
while (line = file.gets)
if (line=~ / = /) != nil
result[line.split(/ = /)[0].to_s] = eval(line.split(/ = /)[1])
end
end
file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment