1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Move singleton method to MiniSSL.java

This commit is contained in:
Jingwen Owen Ou 2012-08-23 19:50:01 -07:00
parent e191003fc4
commit 6a5b30ea30
2 changed files with 18 additions and 7 deletions

View file

@ -10,6 +10,7 @@ import org.jruby.RubyString;
import org.jruby.anno.JRubyMethod;
import org.jruby.runtime.Block;
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
@ -60,6 +61,16 @@ public class MiniSSL extends RubyObject {
this.runtime = runtime;
}
@JRubyMethod(meta = true)
public static IRubyObject server(ThreadContext context, IRubyObject recv, IRubyObject key, IRubyObject cert) {
RubyClass klass = (RubyClass) recv;
IRubyObject newInstance = klass.newInstance(context,
new IRubyObject[] { key, cert },
Block.NULL_BLOCK);
return newInstance;
}
@JRubyMethod
public IRubyObject initialize(IRubyObject key, IRubyObject cert)
throws java.security.KeyStoreException,

View file

@ -83,13 +83,13 @@ module Puma::MiniSSL
VERIFY_NONE = 0
VERIFY_PEER = 1
if defined?(JRUBY_VERSION)
class Engine
def self.server(key, cert)
new(key, cert)
end
end
end
#if defined?(JRUBY_VERSION)
#class Engine
#def self.server(key, cert)
#new(key, cert)
#end
#end
#end
class Server
def initialize(socket, ctx)