Results for: "fnmatch"

Calls the given block for each value in 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.

Iterates over keys and values. Note that unlike other collections, each without block isn’t supported.

Iterates over keys. Note that unlike other collections, each_key without block isn’t supported.

Iterates over values. Note that unlike other collections, each_value without block isn’t supported.

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

No documentation available

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.

Example

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.

Example

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...

PKCS #5 PBKDF2 (Password-Based Key Derivation Function 2) in combination with HMAC. Takes pass, salt and iterations, and then derives a key of length bytes.

For more information about PBKDF2, see RFC 2898 Section 5.2 (www.rfc-editor.org/rfc/rfc2898#section-5.2).

Parameters

pass

The password.

salt

The salt. Salts prevent attacks based on dictionaries of common passwords and attacks based on rainbow tables. It is a public value that can be safely stored along with the password (e.g. if the derived value is used for password storage).

iterations

The iteration count. This provides the ability to tune the algorithm. It is better to use the highest count possible for the maximum resistance to brute-force attacks.

length

The desired length of the derived key in octets.

hash

The hash algorithm used with HMAC for the PRF. May be a String representing the algorithm name, or an instance of OpenSSL::Digest.

Returns an Array of individual raw profile data Hashes ordered from earliest to latest by :GC_INVOKE_TIME.

For example:

[
  {
     :GC_TIME=>1.3000000000000858e-05,
     :GC_INVOKE_TIME=>0.010634999999999999,
     :HEAP_USE_SIZE=>289640,
     :HEAP_TOTAL_SIZE=>588960,
     :HEAP_TOTAL_OBJECTS=>14724,
     :GC_IS_MARKED=>false
  },
  # ...
]

The keys mean:

:GC_TIME

Time elapsed in seconds for this GC run

:GC_INVOKE_TIME

Time elapsed in seconds from startup to when the GC was invoked

:HEAP_USE_SIZE

Total bytes of heap used

:HEAP_TOTAL_SIZE

Total size of heap in bytes

:HEAP_TOTAL_OBJECTS

Total number of objects

:GC_IS_MARKED

Returns true if the GC is in mark phase

If ruby was built with GC_PROFILE_MORE_DETAIL, you will also have access to the following hash keys:

:GC_MARK_TIME
:GC_SWEEP_TIME
:ALLOCATE_INCREASE
:ALLOCATE_LIMIT
:HEAP_USE_PAGES
:HEAP_LIVE_OBJECTS
:HEAP_FREE_OBJECTS
:HAVE_FINALIZE

Generate a sequence of checkbox elements, as a String.

The checkboxes will all have the same name attribute. Each checkbox is followed by a label. There will be one checkbox for each value. Each value can be specified as a String, which will be used both as the value of the VALUE attribute and as the label for that checkbox. A single-element array has the same effect.

Each value can also be specified as a three-element array. The first element is the VALUE attribute; the second is the label; and the third is a boolean specifying whether this checkbox is CHECKED.

Each value can also be specified as a two-element array, by omitting either the value element (defaults to the same as the label), or the boolean checked element (defaults to false).

checkbox_group("name", "foo", "bar", "baz")
  # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
  # <INPUT TYPE="checkbox" NAME="name" VALUE="bar">bar
  # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz

checkbox_group("name", ["foo"], ["bar", true], "baz")
  # <INPUT TYPE="checkbox" NAME="name" VALUE="foo">foo
  # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="bar">bar
  # <INPUT TYPE="checkbox" NAME="name" VALUE="baz">baz

checkbox_group("name", ["1", "Foo"], ["2", "Bar", true], "Baz")
  # <INPUT TYPE="checkbox" NAME="name" VALUE="1">Foo
  # <INPUT TYPE="checkbox" CHECKED NAME="name" VALUE="2">Bar
  # <INPUT TYPE="checkbox" NAME="name" VALUE="Baz">Baz

checkbox_group("NAME" => "name",
                 "VALUES" => ["foo", "bar", "baz"])

checkbox_group("NAME" => "name",
                 "VALUES" => [["foo"], ["bar", true], "baz"])

checkbox_group("NAME" => "name",
                 "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"])

Generate an Image Button Input element as a string.

src is the URL of the image to use for the button. name is the input name. alt is the alternative text for the image.

Alternatively, the attributes can be specified as a hash.

image_button("url")
  # <INPUT TYPE="image" SRC="url">

image_button("url", "name", "string")
  # <INPUT TYPE="image" SRC="url" NAME="name" ALT="string">

image_button("SRC" => "url", "ALT" => "string")
  # <INPUT TYPE="image" SRC="url" ALT="string">
No documentation available
No documentation available

Calls the block with each key/value pair:

res = Net::HTTP.get_response(hostname, '/todos/1')
res.each_header do |key, value|
  p [key, value] if key.start_with?('c')
end

Output:

["content-type", "application/json; charset=utf-8"]
["connection", "keep-alive"]
["cache-control", "max-age=43200"]
["cf-cache-status", "HIT"]
["cf-ray", "771d17e9bc542cf5-ORD"]

Returns an enumerator if no block is given.

Net::HTTPHeader#each is an alias for Net::HTTPHeader#each_header.

Calls the block with each field key:

res = Net::HTTP.get_response(hostname, '/todos/1')
res.each_key do |key|
  p key if key.start_with?('c')
end

Output:

"content-type"
"connection"
"cache-control"
"cf-cache-status"
"cf-ray"

Returns an enumerator if no block is given.

Net::HTTPHeader#each_name is an alias for Net::HTTPHeader#each_key.

Search took: 4ms  ·  Total Results: 2538