Sets the replacement string.
ec = Encoding::Converter.new("utf-8", "us-ascii", :undef => :replace) ec.replacement = "<undef>" p ec.convert("a \u3042 b") #=> "a <undef> b"
Parses the given string into an abstract syntax tree, returning the root node of that tree.
SyntaxError
is raised if the given string is invalid syntax.
RubyVM::AbstractSyntaxTree.parse("x = 1 + 2") # => #<RubyVM::AbstractSyntaxTree::Node(NODE_SCOPE(0) 1:0, 1:9): >
Updates the digest using a given string and returns self.
The update() method and the left-shift operator are overridden by each implementation subclass. (One should be an alias for the other)
Returns digest_obj.digest_length().
Construct a new class given a C:
class klass
(CUnion
, CStruct
, or other that provide an entity_class)
types
(Fiddle::TYPE_INT, Fiddle::TYPE_SIZE_T, etc., see the C types constants)
corresponding members
Fiddle::Importer#struct
and Fiddle::Importer#union
wrap this functionality in an easy-to-use manner.
Example:
require 'fiddle/struct' require 'fiddle/cparser' include Fiddle::CParser types, members = parse_struct_signature(['int i','char c']) MyStruct = Fiddle::CStructBuilder.create(Fiddle::CUnion, types, members) obj = MyStruct.allocate
Construct a new class given a C:
class klass
(CUnion
, CStruct
, or other that provide an entity_class)
types
(Fiddle::TYPE_INT, Fiddle::TYPE_SIZE_T, etc., see the C types constants)
corresponding members
Fiddle::Importer#struct
and Fiddle::Importer#union
wrap this functionality in an easy-to-use manner.
Example:
require 'fiddle/struct' require 'fiddle/cparser' include Fiddle::CParser types, members = parse_struct_signature(['int i','char c']) MyStruct = Fiddle::CStructBuilder.create(Fiddle::CUnion, types, members) obj = MyStruct.allocate
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.
Return true
if the PRNG has been seeded with enough data, false
otherwise.
The current status of GC
profile mode.
Starts the GC
profiler.
Escape only the tags of certain HTML elements in string
.
Takes an element or elements or array of elements. Each element is specified by the name of the element, without angle brackets. This matches both the start and the end tag of that element. The attribute list of the open tag will also be escaped (for instance, the double-quotes surrounding attribute values).
print CGI::escapeElement('<BR><A HREF="url"></A>', "A", "IMG") # "<BR><A HREF="url"></A>" print CGI::escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"]) # "<BR><A HREF="url"></A>"
Undo escaping such as that done by CGI::escapeElement()
print CGI::unescapeElement( CGI::escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG") # "<BR><A HREF="url"></A>" print CGI::unescapeElement( CGI::escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"]) # "<BR><A HREF="url"></A>"
Returns whether the form contained multipart/form-data
Parses self
destructively and returns self
containing the rest arguments left unparsed.
This is entirely Mike Stok’s beast
If a doctype includes an ATTLIST declaration, it will cause this method to be called. The content is the declaration itself, unparsed. EG, <!ATTLIST el attr CDATA REQUIRED> will come to this method as “el attr CDATA REQUIRED”. This is the same for all of the .*decl methods.