Skip to content

Commit

Permalink
[refactor] cleanup native impls that are now in .rb
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Jun 20, 2024
1 parent 0d06604 commit ad6bc89
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions src/main/java/org/jruby/ext/openssl/X509Extension.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.bouncycastle.asn1.ASN1Encoding;
import org.bouncycastle.asn1.ASN1Integer;
import org.bouncycastle.asn1.ASN1IA5String;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
Expand All @@ -62,7 +61,6 @@
import org.jruby.Ruby;
import org.jruby.RubyArray;
import org.jruby.RubyClass;
import org.jruby.RubyHash;
import org.jruby.RubyModule;
import org.jruby.RubyNumeric;
import org.jruby.RubyObject;
Expand All @@ -78,7 +76,6 @@
import static org.jruby.ext.openssl.ASN1._ASN1;
import static org.jruby.ext.openssl.X509._X509;
import static org.jruby.ext.openssl.OpenSSL.*;
import static org.jruby.ext.openssl.StringHelper.*;

/**
* OpenSSL::X509::Extension
Expand Down Expand Up @@ -846,44 +843,6 @@ public IRubyObject eql_p(IRubyObject obj) {
return equalImpl(getRuntime(), obj);
}

// [ self.oid, self.value, self.critical? ]
@JRubyMethod
public RubyArray to_a(final ThreadContext context) {
RubyArray array = RubyArray.newArray(context.runtime, 3);
array.append(oid(context));
array.append(value(context));
array.append(critical_p(context));
return array;
}

// {"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical?
@JRubyMethod
public RubyHash to_h(final ThreadContext context) {
final Ruby runtime = context.runtime;
RubyHash hash = RubyHash.newHash(runtime);
hash.op_aset(context, newStringFrozen(runtime, "oid"), oid(context));
hash.op_aset(context, newStringFrozen(runtime, "value"), value(context));
hash.op_aset(context, newStringFrozen(runtime, "critical"), critical_p(context));
return hash;
}

// "oid = critical, value"
@JRubyMethod
public RubyString to_s(final ThreadContext context) {
final Ruby runtime = context.runtime;
final RubyString str = RubyString.newString(runtime, oidSym(runtime));
str.getByteList().append(' ').append('=').append(' ');
if ( isRealCritical() ) str.getByteList().append(critical__);
// self.value.gsub(/\n/, ", ")
final RubyString value = value(context);
value.callMethod(context, "gsub!", new IRubyObject[] {
RubyString.newStringShared(runtime, StringHelper.NEW_LINE),
RubyString.newStringShared(runtime, StringHelper.COMMA_SPACE)
});
str.getByteList().append(value.getByteList());
return str;
}

@Override
public X509Extension clone() {
try {
Expand Down

0 comments on commit ad6bc89

Please sign in to comment.