Processes requests on sock
Converts version
into an HTTPVersion
You must subclass GenericServer
and implement #run which accepts a TCP client socket
Converts the contents of the database to an in-memory Hash
, then calls Hash#reject
with the specified code block, returning a new Hash
.
Override the inspection method.
system("false") p $?.inspect #=> "#<Process::Status: pid 12861 exit 1>"
Returns a printable version of ec
ec = Encoding::Converter.new("iso-8859-1", "utf-8") puts ec.inspect #=> #<Encoding::Converter: ISO-8859-1 to UTF-8>
Returns the conversion path of ec.
The result is an array of conversions.
ec = Encoding::Converter.new("ISO-8859-1", "EUC-JP", crlf_newline: true) p ec.convpath #=> [[#<Encoding:ISO-8859-1>, #<Encoding:UTF-8>], # [#<Encoding:UTF-8>, #<Encoding:EUC-JP>], # "crlf_newline"]
Each element of the array is a pair of encodings or a string. A pair means an encoding conversion. A string means a decorator.
In the above example, [#<Encoding:ISO-8859-1>,
Convert source_string and return destination_string.
source_string is assumed as a part of source. i.e. :partial_input=>true is specified internally. finish method should be used last.
ec = Encoding::Converter.new("utf-8", "euc-jp") puts ec.convert("\u3042").dump #=> "\xA4\xA2" puts ec.finish.dump #=> "" ec = Encoding::Converter.new("euc-jp", "utf-8") puts ec.convert("\xA4").dump #=> "" puts ec.convert("\xA2").dump #=> "\xE3\x81\x82" puts ec.finish.dump #=> "" ec = Encoding::Converter.new("utf-8", "iso-2022-jp") puts ec.convert("\xE3").dump #=> "".force_encoding("ISO-2022-JP") puts ec.convert("\x81").dump #=> "".force_encoding("ISO-2022-JP") puts ec.convert("\x82").dump #=> "\e$B$\"".force_encoding("ISO-2022-JP") puts ec.finish.dump #=> "\e(B".force_encoding("ISO-2022-JP")
If a conversion error occur, Encoding::UndefinedConversionError
or Encoding::InvalidByteSequenceError
is raised. Encoding::Converter#convert
doesn’t supply methods to recover or restart from these exceptions. When you want to handle these conversion errors, use Encoding::Converter#primitive_convert
.
Creates a printable version of the digest object.
Creates a class to wrap the C struct described by signature
.
MyStruct = struct ['int i', 'char c']
Similar to read, but raises EOFError
at end of string instead of returning nil
, as well as IO#sysread
does.
Reads at most maxlen bytes from the stream. If buf is provided it must reference a string which will receive the data.
See IO#readpartial
for full details.
Pushes character c back onto the stream such that a subsequent buffered character read will return it.
Unlike IO#getc
multiple bytes may be pushed back onto the stream.
Has no effect on unbuffered reads (such as sysread).
URL-decode a string with encoding(optional).
string = CGI::unescape("%27Stop%21%27+said+Fred") # => "'Stop!' said Fred"
Unescape a string that has been HTML-escaped
CGI::unescapeHTML("Usage: foo "bar" <baz>") # => "Usage: foo \"bar\" <baz>"
Returns “true” if the “transfer-encoding” header is present and set to “chunked”. This is an HTTP/1.1 feature, allowing the the content to be sent in “chunks” without at the outset stating the entire content length.
Handles a doctype declaration. Any attributes of the doctype which are not supplied will be nil. # EG, <!DOCTYPE me PUBLIC “foo” “bar”> @p name the name of the doctype; EG, “me” @p pub_sys “PUBLIC”, “SYSTEM”, or nil. EG, “PUBLIC” @p long_name the supplied long name, or nil. EG, “foo” @p uri the uri of the doctype, or nil. EG, “bar”
<!ENTITY …> The argument passed to this method is an array of the entity declaration. It can be in a number of formats, but in general it returns (example, result):
<!ENTITY % YN '"Yes"'> ["%", "YN", "\"Yes\""] <!ENTITY % YN 'Yes'> ["%", "YN", "Yes"] <!ENTITY WhatHeSaid "He said %YN;"> ["WhatHeSaid", "He said %YN;"] <!ENTITY open-hatch SYSTEM "http://www.textuality.com/boilerplate/OpenHatch.xml"> ["open-hatch", "SYSTEM", "http://www.textuality.com/boilerplate/OpenHatch.xml"] <!ENTITY open-hatch PUBLIC "-//Textuality//TEXT Standard open-hatch boilerplate//EN" "http://www.textuality.com/boilerplate/OpenHatch.xml">
<!ENTITY hatch-pic SYSTEM “../grafix/OpenHatch.gif” NDATA gif>
Handles a doctype declaration. Any attributes of the doctype which are not supplied will be nil. # EG, <!DOCTYPE me PUBLIC “foo” “bar”> @p name the name of the doctype; EG, “me” @p pub_sys “PUBLIC”, “SYSTEM”, or nil. EG, “PUBLIC” @p long_name the supplied long name, or nil. EG, “foo” @p uri the uri of the doctype, or nil. EG, “bar”