Results for: "pstore"

Returns the bytes to be read again when Encoding::InvalidByteSequenceError occurs.

Returns the destination encoding as an Encoding object.

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.

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

Returns a new instance of the C struct with the value ty at the addr address.

Returns a new Fiddle::Pointer instance at the memory address of the given name symbol.

Raises a DLError if the name doesn’t exist.

See Fiddle::CompositeHandler.sym and Fiddle::Handle.sym

Returns a new Fiddle::Function instance at the memory address of the given name function.

Raises a DLError if the name doesn’t exist.

See also Fiddle:Function.new

See Fiddle::CompositeHandler.sym and Fiddle::Handler.sym

Similar to read, but raises EOFError at end of string unless the +exception: false+ option is passed in.

Reads at most maxlen bytes in the non-blocking manner.

When no data can be read without blocking it raises OpenSSL::SSL::SSLError extended by IO::WaitReadable or IO::WaitWritable.

IO::WaitReadable means SSL needs to read internally so read_nonblock should be called again when the underlying IO is readable.

IO::WaitWritable means SSL needs to write internally so read_nonblock should be called again after the underlying IO is writable.

OpenSSL::Buffering#read_nonblock needs two rescue clause as follows:

# emulates blocking read (readpartial).
begin
  result = ssl.read_nonblock(maxlen)
rescue IO::WaitReadable
  IO.select([io])
  retry
rescue IO::WaitWritable
  IO.select(nil, [io])
  retry
end

Note that one reason that read_nonblock writes to the underlying IO is when the peer requests a new TLS/SSL handshake. See openssl the FAQ for more details. www.openssl.org/support/faq.html

By specifying a keyword argument exception to false, you can indicate that read_nonblock should not raise an IO::Wait*able exception, but return the symbol :wait_writable or :wait_readable instead. At EOF, it will return nil instead of raising EOFError.

Generates a mask value for priority levels at or below the level specified. See mask=

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

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

Generates a radio-button Input element.

name is the name of the input field. value is the value of the field if checked. checked specifies whether the field starts off checked.

Alternatively, the attributes can be specified as a hash.

radio_button("name", "value")
  # <INPUT TYPE="radio" NAME="name" VALUE="value">

radio_button("name", "value", true)
  # <INPUT TYPE="radio" NAME="name" VALUE="value" CHECKED>

radio_button("NAME" => "name", "VALUE" => "value", "ID" => "foo")
  # <INPUT TYPE="radio" NAME="name" VALUE="value" ID="foo">
No documentation available

just for compatibility

Add a new protocol to the DRbProtocol module.

Add a new protocol to the DRbProtocol module.

Returns a hash of the key/value pairs:

req = Net::HTTP::Get.new(uri)
req.to_hash
# =>
{"accept-encoding"=>["gzip;q=1.0,deflate;q=0.6,identity;q=0.3"],
 "accept"=>["*/*"],
 "user-agent"=>["Ruby"],
 "host"=>["jsonplaceholder.typicode.com"]}
No documentation available

Stores form data to be used in a POST or PUT request.

The form data given in params consists of zero or more fields; each field is:

Argument params should be an Enumerable (method params.map will be called), and is often an array or hash.

First, we set up a request:

_uri = uri.dup
_uri.path ='/posts'
req = Net::HTTP::Post.new(_uri)

Argument params As an Array

When params is an array, each of its elements is a subarray that defines a field; the subarray may contain:

The various forms may be mixed:

req.set_form(['foo', %w[bar 1], ['file', file]])

Argument params As a Hash

When params is a hash, each of its entries is a name/value pair that defines a field:

Examples:

# Nil-valued fields.
req.set_form({'foo' => nil, 'bar' => nil, 'baz' => nil})

# String-valued fields.
req.set_form({'foo' => 0, 'bar' => 1, 'baz' => 2})

# IO-valued field.
require 'stringio'
req.set_form({'file' => StringIO.new('Ruby is cool.')})

# Mixture of fields.
req.set_form({'foo' => nil, 'bar' => 1, 'file' => file})

Optional argument enctype specifies the value to be given to field 'Content-Type', and must be one of:

Optional argument formopt is a hash of options (applicable only when argument enctype is 'multipart/form-data') that may include the following entries:

returns a Time that represents the Last-Modified field.

Search took: 6ms  ·  Total Results: 3855