Ruby is the Best Javascript
summary
Claims Ruby can be made to look and behave like JavaScript by abusing syntax and metaprogramming: defines Javascript-style var and console.log, builds anonymous functions that are declared like JS and invoked like methods, and runs the demo code successfully. Techniques include global method_missing, using Object.new and instance_eval to bind block args, and using eval + local_variables search plus send and define_method. Six core stdlib receivers (to_a to_int etc) break with the hack, and the contraption actually works onstage.
AI-written summary · about
chapters (19)
- 0:00Ruby is the Best Javascript
- 1:50Inspiration
- 2:34Taking it further
- 4:18Console.foo
- 5:26Splat
- 7:20Anonymous Classes
- 8:25Anonymous Object
- 10:04Anonymous Functions // Javascript
- 13:19Main Object
- 15:31Method Missing
- 17:06GlobalMissing
- 20:12Send some_obj = ['a', 'b', 'c']
- 21:42Instance Eval
- 22:34Function Function
- 24:42Define_method
- 26:30Local Variables
- 28:33Back to the Function
- 29:17Var Redux
- 32:17Tiny Text Success!








