Skip to content

Instantly share code, notes, and snippets.

@youpy
Created August 14, 2012 12:28
Show Gist options
  • Save youpy/3348932 to your computer and use it in GitHub Desktop.
Save youpy/3348932 to your computer and use it in GitHub Desktop.
require 'v8'
require 'open-uri'
class ZWS
def initialize
@cxt = V8::Context.new
open("https://raw.github.com/youpy/node-zws/master/lib/zws.js") do |file|
@cxt.eval(file, "zws.js")
end
end
def encode(text)
@cxt.eval('ZWS.encode').call(text)
end
def decode(text)
@cxt.eval('ZWS.decode').call(text)
end
end
z = ZWS.new
z.encode("hello")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment