Merges a base path base
, with relative path rel
, returns a modified base path.
Private setter for attributes val
.
Checks the to v
component.
Returns the RFC822 e-mail text equivalent of the URL, as a String
.
Example:
require 'uri' uri = URI.parse("mailto:ruby-list@ruby-lang.org?Subject=subscribe&cc=myaddr") uri.to_mailtext # => "To: ruby-list@ruby-lang.org\nSubject: subscribe\nCc: myaddr\n\n\n"
Returns Regexp
that is default self.regexp[:ABS_URI_REF]
, unless schemes
is provided. Then it is a Regexp.union
with self.pattern[:X_ABS_URI]
.
Constructs the default Hash
of patterns.
Returns Regexp
that is default self.regexp[:ABS_URI_REF]
, unless schemes
is provided. Then it is a Regexp.union
with self.pattern[:X_ABS_URI]
.
Constructs the default Hash
of patterns.
Returns an array containing the values associated with the given keys.
Calls the given block once for each key
, value
pair in the database.
Returns self
.
Returns the destination encoding as an encoding object.
Returns the one-character string which cause Encoding::UndefinedConversionError
.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP") begin ec.convert("\xa0") rescue Encoding::UndefinedConversionError puts $!.error_char.dump #=> "\xC2\xA0" p $!.error_char.encoding #=> #<Encoding:UTF-8> end
Returns the destination encoding as an encoding object.
Returns the corresponding ASCII compatible encoding.
Returns nil if the argument is an ASCII compatible encoding.
“corresponding ASCII compatible encoding” is an ASCII compatible encoding which can represents exactly the same characters as the given ASCII incompatible encoding. So, no conversion undefined error occurs when converting between the two encodings.
Encoding::Converter.asciicompat_encoding("ISO-2022-JP") #=> #<Encoding:stateless-ISO-2022-JP> Encoding::Converter.asciicompat_encoding("UTF-16BE") #=> #<Encoding:UTF-8> Encoding::Converter.asciicompat_encoding("UTF-8") #=> nil
Returns the destination encoding as an Encoding
object.
Format a Time
object as a String
using the format specified by RFC 1123.
CGI.rfc1123_date(Time.now) # Sat, 01 Jan 2000 00:00:00 GMT
Parses a C prototype signature
If Hash
tymap
is provided, the return value and the arguments from the signature
are expected to be keys, and the value will be the C type to be looked up.
Example:
require 'fiddle/import' include Fiddle::CParser #=> Object parse_signature('double sum(double, double)') #=> ["sum", Fiddle::TYPE_DOUBLE, [Fiddle::TYPE_DOUBLE, Fiddle::TYPE_DOUBLE]] parse_signature('void update(void (*cb)(int code))') #=> ["update", Fiddle::TYPE_VOID, [Fiddle::TYPE_VOIDP]] parse_signature('char (*getbuffer(void))[80]') #=> ["getbuffer", Fiddle::TYPE_VOIDP, []]
Creates a class to wrap the C struct with the value ty
See also Fiddle::Importer.struct
Calls the given block once for each byte in the stream.
OpenSSL::PKCS5.pbkdf2_hmac
has been renamed to OpenSSL::KDF.pbkdf2_hmac
. This method is provided for backwards compatibility.
Generates new parameters for the algorithm. algo_name is a String
that represents the algorithm. The optional argument options is a Hash
that specifies the options specific to the algorithm. The order of the options can be important.
A block can be passed optionally. The meaning of the arguments passed to the block varies depending on the implementation of the algorithm. The block may be called once or multiple times, or may not even be called.
For the supported options, see the documentation for the ‘openssl genpkey’ utility command.
pkey = OpenSSL::PKey.generate_parameters("DSA", "dsa_paramgen_bits" => 2048) p pkey.p.num_bits #=> 2048
Generates a new key (pair).
If a String
is given as the first argument, it generates a new random key for the algorithm specified by the name just as ::generate_parameters
does. If an OpenSSL::PKey::PKey
is given instead, it generates a new random key for the same algorithm as the key, using the parameters the key contains.
See ::generate_parameters
for the details of options and the given block.
pkey_params = OpenSSL::PKey.generate_parameters("DSA", "dsa_paramgen_bits" => 2048) pkey_params.priv_key #=> nil pkey = OpenSSL::PKey.generate_key(pkey_params) pkey.priv_key #=> #<OpenSSL::BN 6277...