Created
June 19, 2014 23:03
-
-
Save dmcclory/f754d555e864ac25a0b0 to your computer and use it in GitHub Desktop.
get a hash of local variables from a binding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def hash_for_binding(b) | |
vars = b.eval('local_variables') | |
vars.inject({}) { |memo, var| | |
memo[var] = b.eval(var.to_s) | |
memo | |
} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment