Private method to cleanup dn
from using the path
component attribute.
Private method to cleanup attributes
, scope
, filter
, and extensions
from using the query
component attribute.
Private setter for attributes val
.
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
.
Reads the file from pathname, then parses it like ::parse
, returning the root node of the abstract syntax tree.
SyntaxError
is raised if pathname’s contents are not valid Ruby syntax.
RubyVM::AbstractSyntaxTree.parse_file("my-app/app.rb") # => #<RubyVM::AbstractSyntaxTree::Node:SCOPE@1:0-31:3>
Synonym for CGI.escapeElement(str)
Synonym for CGI.unescapeElement(str)
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
Returns the length of the hash value of the digest.
This method should be overridden by each implementation subclass. If not, digest_obj.digest().length() is returned.
Returns the block length of the digest.
This method is overridden by each implementation subclass.
Given a String
of C type ty
, returns the corresponding Fiddle
constant.
ty
can also accept an Array
of C type Strings, and will be returned in a corresponding Array
.
If Hash
tymap
is provided, ty
is expected to be the key, and the value will be the C type to be looked up.
Example:
require 'fiddle/import' include Fiddle::CParser #=> Object parse_ctype('int') #=> Fiddle::TYPE_INT parse_ctype('double diff') #=> Fiddle::TYPE_DOUBLE parse_ctype('unsigned char byte') #=> -Fiddle::TYPE_CHAR parse_ctype('const char* const argv[]') #=> -Fiddle::TYPE_VOIDP
Creates a class to wrap the C struct with the value ty
See also Fiddle::Importer.struct
Consumes size bytes from the buffer
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
The total time used for garbage collection in seconds
Parses multipart form elements according to
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2
Returns a hash of multipart form parameters with bodies of type StringIO
or Tempfile
depending on whether the multipart form element exceeds 10 KB
params[name => body]
Generate a Form element with multipart encoding as a String
.
Multipart encoding is used for forms that include file uploads.
action
is the action to perform. enctype
is the encoding type, which defaults to “multipart/form-data”.
Alternatively, the attributes can be specified as a hash.
multipart_form{ "string" } # <FORM METHOD="post" ENCTYPE="multipart/form-data">string</FORM> multipart_form("url") { "string" } # <FORM METHOD="post" ACTION="url" ENCTYPE="multipart/form-data">string</FORM>
Generate a Password Input element as a string.
name
is the name of the input field. value
is its default value. size
is the size of the input field display. maxlength
is the maximum length of the inputted password.
Alternatively, attributes can be specified as a hash.
password_field("name") # <INPUT TYPE="password" NAME="name" SIZE="40"> password_field("name", "value") # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="40"> password_field("password", "value", 80, 200) # <INPUT TYPE="password" NAME="name" VALUE="value" SIZE="80" MAXLENGTH="200"> password_field("NAME" => "name", "VALUE" => "value") # <INPUT TYPE="password" NAME="name" VALUE="value">
Generate a Select element as a string.
name
is the name of the element. The values
are the options that can be selected from the Select menu. Each value can be a String
or a one, two, or three-element Array
. If a String
or a one-element Array
, this is both the value of that option and the text displayed for it. If a three-element Array
, the elements are the option value, displayed text, and a boolean value specifying whether this option starts as selected. The two-element version omits either the option value (defaults to the same as the display text) or the boolean selected specifier (defaults to false).
The attributes and options can also be specified as a hash. In this case, options are specified as an array of values as described above, with the hash key of “VALUES”.
popup_menu("name", "foo", "bar", "baz") # <SELECT NAME="name"> # <OPTION VALUE="foo">foo</OPTION> # <OPTION VALUE="bar">bar</OPTION> # <OPTION VALUE="baz">baz</OPTION> # </SELECT> popup_menu("name", ["foo"], ["bar", true], "baz") # <SELECT NAME="name"> # <OPTION VALUE="foo">foo</OPTION> # <OPTION VALUE="bar" SELECTED>bar</OPTION> # <OPTION VALUE="baz">baz</OPTION> # </SELECT> popup_menu("name", ["1", "Foo"], ["2", "Bar", true], "Baz") # <SELECT NAME="name"> # <OPTION VALUE="1">Foo</OPTION> # <OPTION SELECTED VALUE="2">Bar</OPTION> # <OPTION VALUE="Baz">Baz</OPTION> # </SELECT> popup_menu("NAME" => "name", "SIZE" => 2, "MULTIPLE" => true, "VALUES" => [["1", "Foo"], ["2", "Bar", true], "Baz"]) # <SELECT NAME="name" MULTIPLE SIZE="2"> # <OPTION VALUE="1">Foo</OPTION> # <OPTION SELECTED VALUE="2">Bar</OPTION> # <OPTION VALUE="Baz">Baz</OPTION> # </SELECT>
Returns an Integer
object which represents the HTTP
Content-Length: header field, or nil
if that field was not provided.
The length of the range represented in Content-Range: header.