Guest User

Untitled

a guest
Jul 16th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. class Bar
  2.  
  3. class MyScope
  4. attr_accessor :x
  5. end
  6.  
  7. scope = MyScope.new
  8. scope.x = 4
  9.  
  10. cm = dynamic_method :foo do |g|
  11. g.push_literal Time.now.to_s
  12. g.push_literal scope
  13. g.send :x, 0
  14. g.push_int 3
  15. g.send :+, 1
  16. g.ret
  17. end
  18.  
  19. puts cm.decode
  20. end
  21.  
  22. p Bar.new.foo
Add Comment
Please, Sign In to add comment