Skip to content

Instantly share code, notes, and snippets.

@jkugler
Created February 16, 2016 19:33
Show Gist options
  • Save jkugler/51b5e7a1f492fbfe13df to your computer and use it in GitHub Desktop.
Save jkugler/51b5e7a1f492fbfe13df to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def eval_script filename
# Creates a new empty hash when accessing a hash that doesn't exist
default = Hash.new { |h, k| h[k] = Hash.new(&h.default_proc) }
eval(File.read(filename), binding, filename)
default
end
# All data from default.rb now available in 'default'
default = eval_script 'default.rb'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment