A collection of constants and functions for testing Mongrel2 applications, as well as Mongrel2 itself.
A Mongrel2 connector and configuration library for Ruby.
Michael Granger <ged@FaerieMUD.org>
Version-control revision constant
Library version constant
Factory method that creates subclasses of Mongrel2::Config.
# File lib/mongrel2/config.rb, line 243
def self::Config( source )
unless Sequel::Model::ANONYMOUS_MODEL_CLASSES.key?( source )
anonclass = nil
if source.is_a?( Sequel::Database )
anonclass = Class.new( Mongrel2::Config )
anonclass.db = source
else
anonclass = Class.new( Mongrel2::Config ).set_dataset( source )
end
Sequel::Model::ANONYMOUS_MODEL_CLASSES[ source ] = anonclass
end
return Sequel::Model::ANONYMOUS_MODEL_CLASSES[ source ]
end
Get the library version. If include_buildnum is true, the
version string will include the VCS rev ID.
# File lib/mongrel2.rb, line 35
def self::version_string( include_buildnum=false )
vstring = "Ruby-Mongrel2 %s" % [ VERSION ]
vstring << " (build %s)" % [ REVISION[%r: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
return vstring
end
Fetch the ZMQ::Context for sockets, creating it if necessary.
# File lib/mongrel2.rb, line 46
def self::zmq_context
if @zmq_ctx.nil?
self.log.info "Using 0MQ %d.%d.%d" % ZMQ.version
@zmq_ctx = ZMQ::Context.new
end
return @zmq_ctx
end