Guest User

Untitled

a guest
May 24th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. raw = 'PARAM1 = #{param_1}, PARAM2 = #{param_2}'
  2. params = { :param_1 => "foo", :param_2 => "bar" }
  3.  
  4. query = proc do |*args|
  5. @params = params
  6. def method_missing(key)
  7. @params[key.to_sym]
  8. end
  9. eval('"' + raw + '"')
  10. end
  11.  
  12. puts query.call(params)
Add Comment
Please, Sign In to add comment