Creates a GzipWriter
object associated with io
. level
and strategy
should be the same as the arguments of Zlib::Deflate.new
. The GzipWriter
object writes gzipped data to io
. io
must respond to the write
method that behaves the same as IO#write
.
The options
hash may be used to set the encoding of the data. :external_encoding
, :internal_encoding
and :encoding
may be set as in IO::new
.
Creates a GzipReader
object associated with io
. The GzipReader
object reads gzipped data from io
, and parses/decompresses it. The io
must have a read
method that behaves same as the IO#read
.
The options
hash may be used to set the encoding of the data. :external_encoding
, :internal_encoding
and :encoding
may be set as in IO::new
.
If the gzip file header is incorrect, raises an Zlib::GzipFile::Error
exception.
File::Stat.new(file_name) -> stat
Create a File::Stat
object for the given file name (raising an exception if the file doesn’t exist).
Takes source
, a String
of Ruby code and compiles it to an InstructionSequence
.
Optionally takes file
, path
, and line
which describe the file path, real path and first line number of the ruby code in source
which are metadata attached to the returned iseq
.
file
is used for ‘__FILE__` and exception backtrace. path
is used for require_relative
base. It is recommended these should be the same full path.
options
, which can be true
, false
or a Hash
, is used to modify the default behavior of the Ruby iseq compiler.
For details regarding valid compile options see ::compile_option=
.
RubyVM::InstructionSequence.compile("a = 1 + 2") #=> <RubyVM::InstructionSequence:<compiled>@<compiled>> path = "test.rb" RubyVM::InstructionSequence.compile(File.read(path), path, File.expand_path(path)) #=> <RubyVM::InstructionSequence:<compiled>@test.rb:1> path = File.expand_path("test.rb") RubyVM::InstructionSequence.compile(File.read(path), path, path) #=> <RubyVM::InstructionSequence:<compiled>@/absolute/path/to/test.rb:1>
Returns an initialized Tms
object which has utime
as the user CPU time, stime
as the system CPU time, cutime
as the children’s user CPU time, cstime
as the children’s system CPU time, real
as the elapsed real time and label
as the label.
Specification
constructor. Assigns the default values to the attributes and yields itself for further initialization. Optionally takes name
and version
.
Constructs a dependency with name
and requirements
. The last argument can optionally be the dependency type, which defaults to :runtime
.
Create a new CGI::Cookie
object.
name_string
The name of the cookie; in this form, there is no domain
or expiration. The path
is gleaned from the SCRIPT_NAME
environment variable, and secure
is false.
*value
value or list of values of the cookie
options_hash
A Hash
of options to initialize this Cookie
. Possible options are:
the name of the cookie. Required.
the cookie’s value or list of values.
the path for which this cookie applies. Defaults to the value of the SCRIPT_NAME
environment variable.
the domain for which this cookie applies.
the time at which this cookie expires, as a Time
object.
whether this cookie is a secure cookie or not (default to false). Secure cookies are only transmitted to HTTPS servers.
whether this cookie is a HttpOnly cookie or not (default to
false). HttpOnly cookies are not available to javascript.
These keywords correspond to attributes of the cookie object.
Create a new CGI::Session
object for request
.
request
is an instance of the CGI
class (see cgi.rb). option
is a hash of options for initialising this CGI::Session
instance. The following options are recognised:
the parameter name used for the session id. Defaults to ‘_session_id’.
session_id
the session id to use. If not provided, then it is retrieved from the session_key
parameter of the request, or automatically generated for a new session.
new_session
if true, force creation of a new session. If not set, a new session is only created if none currently exists. If false, a new session is never created, and if none currently exists and the session_id
option is not set, an ArgumentError
is raised.
the name of the class providing storage facilities for session state persistence. Built-in support is provided for FileStore
(the default), MemoryStore
, and PStore
(from cgi/session/pstore.rb). See the documentation for these classes for more details.
The following options are also recognised, but only apply if the session id is stored in a cookie.
the time the current session expires, as a Time
object. If not set, the session will terminate when the user’s browser is closed.
the hostname domain for which this session is valid. If not set, defaults to the hostname of the server.
if true
, this session will only work over HTTPS.
the path for which this session applies. Defaults to the directory of the CGI
script.
option
is also passed on to the session storage class initializer; see the documentation for each session storage class for the options they support.
The retrieved or created session is automatically added to request
as a cookie, and also to its output_hidden
table, which is used to add hidden input elements to forms.
WARNING the output_hidden
fields are surrounded by a <fieldset> tag in HTML 4 generation, which is not invisible on many browsers; you may wish to disable the use of fieldsets with code similar to the following (see blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/37805)
cgi = CGI.new("html4") class << cgi undef_method :fieldset end
A CSV::FieldsConverter
is a data structure for storing the fields converter properties to be passed as a parameter when parsing a new file (e.g. CSV::Parser.new
(@io, parser_options))
Constructs a new CSV::Row
from headers
and fields
, which are expected to be Arrays. If one Array
is shorter than the other, it will be padded with nil
objects.
The optional header_row
parameter can be set to true
to indicate, via CSV::Row.header_row?()
and CSV::Row.field_row?()
, that this is a header row. Otherwise, the row assumes to be a field row.
A CSV::Row
object supports the following Array
methods through delegation:
empty?()
length()
size()
Constructs a new CSV::Table
from array_of_rows
, which are expected to be CSV::Row
objects. All rows are assumed to have the same headers.
The optional headers
parameter can be set to Array
of headers. If headers aren’t set, headers are fetched from CSV::Row
objects. Otherwise, headers() method will return headers being set in headers argument.
A CSV::Table
object supports the following Array
methods through delegation:
empty?()
length()
size()
Creates a new entry using str
.
str
may be “*” or “all” to match any address, an IP address string to match a specific address, an IP address mask per IPAddr
, or one containing “*” to match part of an IPv4 address.
IPAddr::InvalidPrefixError
may be raised when an IP network address with an invalid netmask/prefix is given.
Creates an empty ACLList
Create a new DRbUnknownError
for the DRb::DRbUnknown
object unknown
Creates a new remote error that wraps the Exception
error
Create a new DRbUnknown
object.
buf
is a string containing a marshalled object that could not be unmarshalled. err
is the error message that was raised when the unmarshalling failed. It is used to determine the name of the unmarshalled object.
Creates a new DRbArray
that either dumps or wraps all the items in the Array
ary
so they can be loaded by a remote DRb
server.
Create a new remote object stub.
obj
is the (local) object we want to create a stub for. Normally this is nil
. uri
is the URI
of the remote object that this will be a stub for.