Timothy Goddard
1/21/2006 10:30:00 AM
You could encode your code in base 64 then do something along the lines
of:
# Start example
require 'base64'
code = <<-END_BLOCK
cHV0cyAnSGVsbG8gV29ybGQn
END_BLOCK
eval Base64::decode64(code)
# End example
This, however, has a performance cost and is easily reverse-engineered.
The other option is to include a module written in c that performs the
functions you need to hide and only distribute the compiled code. Be
careful, however, not to link against certain libraries with more
restrictive licenses than ruby's main one.