ruby-changes:35565
From: akr <ko1@a...>
Date: Sat, 20 Sep 2014 10:17:11 +0900 (JST)
Subject: [ruby-changes:35565] akr:r47647 (trunk): * ext/openssl/lib/openssl/x509.rb (OpenSSL::X509::Name#pretty_print):
akr 2014-09-20 10:17:05 +0900 (Sat, 20 Sep 2014) New Revision: 47647 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47647 Log: * ext/openssl/lib/openssl/x509.rb (OpenSSL::X509::Name#pretty_print): New method. (OpenSSL::X509::Certificate#pretty_print): Ditto. * ext/openssl/lib/openssl/bn.rb (OpenSSL::BN#pretty_print): Ditto. Modified files: trunk/ChangeLog trunk/ext/openssl/lib/openssl/bn.rb trunk/ext/openssl/lib/openssl/x509.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 47646) +++ ChangeLog (revision 47647) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Sep 20 10:02:51 2014 Tanaka Akira <akr@f...> + + * ext/openssl/lib/openssl/x509.rb (OpenSSL::X509::Name#pretty_print): + New method. + (OpenSSL::X509::Certificate#pretty_print): Ditto. + + * ext/openssl/lib/openssl/bn.rb (OpenSSL::BN#pretty_print): Ditto. + Sat Sep 20 07:55:57 2014 Nobuyoshi Nakada <nobu@r...> * vm_eval.c (eval_string_with_cref): fix super from eval with Index: ext/openssl/lib/openssl/bn.rb =================================================================== --- ext/openssl/lib/openssl/bn.rb (revision 47646) +++ ext/openssl/lib/openssl/bn.rb (revision 47647) @@ -21,6 +21,13 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/bn.rb#L21 module OpenSSL class BN include Comparable + + def pretty_print(q) + q.object_group(self) { + q.text ' ' + q.text to_i.to_s + } + end end # BN end # OpenSSL Index: ext/openssl/lib/openssl/x509.rb =================================================================== --- ext/openssl/lib/openssl/x509.rb (revision 47646) +++ ext/openssl/lib/openssl/x509.rb (revision 47647) @@ -151,6 +151,13 @@ module OpenSSL https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/x509.rb#L151 alias parse parse_openssl end + + def pretty_print(q) + q.object_group(self) { + q.text ' ' + q.text to_s(OpenSSL::X509::Name::RFC2253) + } + end end class StoreContext @@ -158,5 +165,18 @@ module OpenSSL https://github.com/ruby/ruby/blob/trunk/ext/openssl/lib/openssl/x509.rb#L165 warn "(#{caller.first}) OpenSSL::X509::StoreContext#cleanup is deprecated with no replacement" if $VERBOSE end end + + class Certificate + def pretty_print(q) + q.object_group(self) { + q.breakable + q.text 'subject='; q.pp self.subject; q.text ','; q.breakable + q.text 'issuer='; q.pp self.issuer; q.text ','; q.breakable + q.text 'serial='; q.pp self.serial; q.text ','; q.breakable + q.text 'not_before='; q.pp self.not_before; q.text ','; q.breakable + q.text 'not_after='; q.pp self.not_after + } + end + end end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/