Coverage
provides coverage measurement feature for Ruby. This feature is experimental, so these APIs may be changed in future.
require “coverage”
require or load Ruby source file
Coverage.result
will return a hash that contains filename as key and coverage array as value. A coverage array gives, for each line, the number of line execution by the interpreter. A nil
value means coverage is disabled for this line (lines like else
and end
).
[foo.rb] s = 0 10.times do |x| s += x end if s == 45 p :ok else p :ng end [EOF] require "coverage" Coverage.start require "foo.rb" p Coverage.result #=> {"foo.rb"=>[1, 1, 10, nil, nil, 1, 1, nil, 0, nil]}
The syslog package provides a Ruby interface to the POSIX system logging facility.
Syslog
messages are typically passed to a central logging daemon. The daemon may filter them; route them into different files (usually found under /var/log); place them in SQL databases; forward them to centralized logging servers via TCP or UDP; or even alert the system administrator via email, pager or text message.
Unlike application-level logging via Logger
or Log4r, syslog is designed to allow secure tamper-proof logging.
The syslog protocol is standardized in RFC 5424.
Helper module for easily defining exceptions with predefined messages.
1.
class Foo extend Exception2MessageMapper def_e2message ExistingExceptionClass, "message..." def_exception :NewExceptionClass, "message..."[, superclass] ... end
2.
module Error extend Exception2MessageMapper def_e2message ExistingExceptionClass, "message..." def_exception :NewExceptionClass, "message..."[, superclass] ... end class Foo include Error ... end foo = Foo.new foo.Fail ....
3.
module Error extend Exception2MessageMapper def_e2message ExistingExceptionClass, "message..." def_exception :NewExceptionClass, "message..."[, superclass] ... end class Foo extend Exception2MessageMapper include Error ... end Foo.Fail NewExceptionClass, arg... Foo.Fail ExistingExceptionClass, arg...
444 No Response - Nginx 449 Retry With - Microsoft 450 Blocked by Windows Parental Controls - Microsoft 499 Client Closed Request - Nginx
Base TCP server class. You must subclass GenericServer
and provide a run
method.
This exception is raised if a generator or unparser error occurs.
This class is used as a return value from ObjectSpace::reachable_objects_from
.
When ObjectSpace::reachable_objects_from
returns an object with references to an internal object, an instance of this class is returned.
You can use the type
method to check the type of the internal object.
Raised when a RSS::Maker
attempts to use an unknown maker.
Server error exception
Raised by transcoding methods when a named encoding does not correspond with a known converter.
This exception is raised if a parser error occurs.
This exception is raised if the nesting of parsed data structures is too deep.
This exception is raised if a generator or unparser error occurs.
General error for openssl library configuration files. Including formatting, parsing errors, etc.
Subclass of Zlib::Error
When zlib returns a Z_VERSION_ERROR, usually if the zlib library version is incompatible with the version assumed by the caller.