Wakes up all threads waiting for this lock.
The queue can’t be frozen, so this method raises an exception:
Thread::Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0x...>)
The queue can’t be frozen, so this method raises an exception:
Thread::Queue.new.freeze # Raises TypeError (cannot freeze #<Thread::Queue:0x...>)
Returns the replacement string.
ec = Encoding::Converter.new("euc-jp", "us-ascii") p ec.replacement #=> "?" ec = Encoding::Converter.new("euc-jp", "utf-8") p ec.replacement #=> "\uFFFD"
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"
Prettify (indent) an HTML string.
string
is the HTML string to indent. shift
is the indentation unit to use; it defaults to two spaces.
print CGI.pretty("<HTML><BODY></BODY></HTML>") # <HTML> # <BODY> # </BODY> # </HTML> print CGI.pretty("<HTML><BODY></BODY></HTML>", "\t") # <HTML> # <BODY> # </BODY> # </HTML>
Resets the digest to the initial state and returns self.
This method is overridden by each implementation subclass.
If none is given, returns the resulting hash value of the digest, keeping the digest’s state.
If a string is given, returns the hash value for the given string, resetting the digest to the initial state before and after the process.
Returns the resulting hash value and resets the digest to the initial state.
If none is given, returns the resulting hash value of the digest in a hex-encoded form, keeping the digest’s state.
If a string is given, returns the hash value for the given string in a hex-encoded form, resetting the digest to the initial state before and after the process.
Returns the resulting hash value in a hex-encoded form and resets the digest to the initial state.
Returns digest_obj.hexdigest().
If none is given, returns the resulting hash value of the digest in a base64 encoded form, keeping the digest’s state.
If a string
is given, returns the hash value for the given string
in a base64 encoded form, resetting the digest to the initial state before and after the process.
In either case, the return value is properly padded with ‘=’ and contains no line feeds.
Returns the resulting hash value and resets the digest to the initial state.
Creates a class to wrap the C struct described by signature
.
MyStruct = struct ['int i', 'char c']
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.
Examples:
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) MyStruct.malloc(Fiddle::RUBY_FREE) do |obj| ... end obj = MyStruct.malloc(Fiddle::RUBY_FREE) begin ... ensure obj.call_free end obj = MyStruct.malloc begin ... ensure Fiddle.free obj.to_ptr end
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.
Examples:
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) MyStruct.malloc(Fiddle::RUBY_FREE) do |obj| ... end obj = MyStruct.malloc(Fiddle::RUBY_FREE) begin ... ensure obj.call_free end obj = MyStruct.malloc begin ... ensure Fiddle.free obj.to_ptr end
Like getc
, but raises an exception if already at end-of-stream; see Character IO.
Like getbyte
, but raises an exception if already at end-of-stream; see Byte IO.
Similar to read, but raises EOFError
at end of string instead of returning nil
, as well as IO#sysread
does.
Similar to read, but raises EOFError
at end of string instead of returning nil
, as well as IO#sysread
does.
Reads size bytes from the stream. If buf is provided it must reference a string which will receive the data.
See IO#read
for full details.
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.