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.
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 (tools.ietf.org/html/rfc2898#section-5.2).
The passphrase.
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).
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.
The desired length of the derived key in octets.
The hash algorithm used with HMAC
for the PRF. May be a String
representing the algorithm name, or an instance of OpenSSL::Digest
.
Generates a mask bit for a priority level. See mask=
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
: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
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
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">
Iterates through the header names and values, passing in the name and value to the code block supplied.
Returns an enumerator if no block is given.
Example:
response.header.each_header {|key,value| puts "#{key} = #{value}" }
Iterates through the header names in the header, passing each header name to the code block.
Returns an enumerator if no block is given.
Iterates through header values, passing each value to the code block.
Returns an enumerator if no block is given.
As for each_header
, except the keys are provided in capitalized form.
Note that header names are capitalized systematically; capitalization may not match that used by the remote HTTP
server in its response.
Returns an enumerator if no block is given.
Returns a content type string such as “text”. This method returns nil if Content-Type: header field does not exist.
UNTESTED
Visit all subnodes of self
recursively