RSA signing with Ruby OpenSSL

hi all -

I'm not sure if this is the correct forum but i was wondering if
anyone has successfully done RSA-SHA1 signing with Ruby OpenSSL and
interoperated with Java Servers.

I'm using the following code but i'm not sure if the "sign" method on
works properly -

@key = OpenSSL::PKey::RSA.new(2048)
#sign
@key.send("sign", OpenSSL::Digest.::SHA1.new, "text to sign")

The expected signature from above "sign" is not what i know the Java
crytpo api likes.

Thanks in advance.

regards,
Vaibhav