Returns true
if the named public method is defined by mod. If inherit is set, the lookup will also search mod’s ancestors. String
arguments are converted to symbols.
module A def method1() end end class B protected def method2() end end class C < B include A def method3() end end A.method_defined? :method1 #=> true C.public_method_defined? "method1" #=> true C.public_method_defined? "method1", true #=> true C.public_method_defined? "method1", false #=> true C.public_method_defined? "method2" #=> false C.method_defined? "method2" #=> true
Makes a list of existing class methods public.
String
arguments are converted to symbols. An Array
of Symbols and/or Strings is also accepted.
Checks if a given hash is flagged by Module#ruby2_keywords
(or Proc#ruby2_keywords
). This method is not for casual use; debugging, researching, and some truly necessary cases like serialization of arguments.
ruby2_keywords def foo(*args) Hash.ruby2_keywords_hash?(args.last) end foo(k: 1) #=> true foo({k: 1}) #=> false
Duplicates a given hash and adds a ruby2_keywords flag. This method is not for casual use; debugging, researching, and some truly necessary cases like deserialization of arguments.
h = {k: 1} h = Hash.ruby2_keywords_hash(h) def foo(k: 42) k end foo(*[h]) #=> 1 with neither a warning or an error
Render a template on a new toplevel binding with local variables specified by a Hash
object.
obj can be an instance of InternalObjectWrapper
.
Note that you should not use this method in your application.
Enables measuring GC time. You can get the result with GC.stat(:time)
. Note that GC time measurement can cause some performance overhead.
Returns the measure_total_time
flag (default: true
). Note that measurement can affect the application’s performance.
Returns the latest release version of RubyGems.
Glob pattern for require-able plugin suffixes.
Regexp
for require-able plugin suffixes.
Suffixes for dynamic library require-able paths.
Paths where RubyGems’ .rb files and bin files are installed
Mirror the Prism.parse_file_success?
API by using the serialization API.
Returns a new DH
instance that carries just the DH parameters.
Contrary to the method name, the returned DH
object contains only parameters and not the public key.
This method is provided for backwards compatibility. In most cases, there is no need to call this method.
For the purpose of re-generating the key pair while keeping the parameters, check OpenSSL::PKey.generate_key
.
Example:
# OpenSSL::PKey::DH.generate by default generates a random key pair dh1 = OpenSSL::PKey::DH.generate(2048) p dh1.priv_key #=> #<OpenSSL::BN 1288347...> dhcopy = dh1.public_key p dhcopy.priv_key #=> nil
Returns a new DSA
instance that carries just the DSA parameters and the public key.
This method is provided for backwards compatibility. In most cases, there is no need to call this method.
For the purpose of serializing the public key, to PEM or DER encoding of X.509 SubjectPublicKeyInfo format, check PKey#public_to_pem
and PKey#public_to_der
.
See the OpenSSL
documentation for EC_KEY_get0_public_key()
See the OpenSSL
documentation for EC_KEY_set_public_key()
Returns whether this EC
instance has a public key. The public key (EC::Point
) can be retrieved with EC#public_key
.
Returns a new RSA
instance that carries just the public key components.
This method is provided for backwards compatibility. In most cases, there is no need to call this method.
For the purpose of serializing the public key, to PEM or DER encoding of X.509 SubjectPublicKeyInfo format, check PKey#public_to_pem
and PKey#public_to_der
.
Decrypt string
, which has been encrypted with the private key, with the public key. padding
defaults to PKCS1_PADDING
which is known to be insecure but is kept for backwards compatibility.
Deprecated in version 3.0. Consider using PKey::PKey#sign_raw
and PKey::PKey#verify_raw
, and PKey::PKey#verify_recover
instead.
Encrypt string
with the public key. padding
defaults to PKCS1_PADDING
, which is known to be insecure but is kept for backwards compatibility. The encrypted string output can be decrypted using private_decrypt
.
Deprecated in version 3.0. Consider using PKey::PKey#encrypt
and PKey::PKey#decrypt
instead.
Returns the result of the peer certificates verification. See verify(1) for error values and descriptions.
If no peer certificate was presented X509_V_OK is returned.