Guest User

Untitled

a guest
Oct 11th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. require "./eval_context"
  2.  
  3. module Functions
  4. def z1
  5. x1*x1 + x2*x2
  6. end
  7.  
  8. def z2
  9. x1 + x2
  10. end
  11. end
  12.  
  13. context = EvalContext.new(Functions)
  14. context.load_variables("variables.json")
  15. puts context.functions #=> [:z1, :z2]
  16. puts context.variables #=> [:x1, :x2]
  17. puts context.z1 #=> 13
  18. puts context.z2 #=> 5
Add Comment
Please, Sign In to add comment