Please watch this blog: : https://tenderlovemaking.com/2007/04/15/converting-javascript-to-ruby-with-rkelly.html For example: This Function in javascript function add(a,b){ return a+b; } And this in Ruby def add(a,b) return a+b end