Mongrel2::Config::Server::

DSLMethods

module

DSL methods for the Server context besides those automatically-generated from its columns.

Public Instance Methods

anchor
filter( path, settings={} )

Add a Mongrel2::Config::Filter to the Server object with the specified path (name) and settings hash.

# File lib/mongrel2/config/server.rb, line 208
def filter( path, settings={} )
        self.target.save( :validate => false )

        self.log.debug "Filter [%s]: %p" % [ path, settings ]
        self.target.add_filter( name: path, settings: settings )
end
anchor
host( name, &block )

Add a Mongrel2::Config::Host to the Server object with the given hostname. If a block is specified, it can be used to further configure the Host.

# File lib/mongrel2/config/server.rb, line 195
def host( name, &block )
        self.target.save( :validate => false )

        self.log.debug "Host [%s] (block: %p)" % [ name, block ]
        adapter = Mongrel2::Config::DSL::Adapter.new( Mongrel2::Config::Host, name: name )
        adapter.target.matching = name
        adapter.instance_eval( &block ) if block
        self.target.add_host( adapter.target )
end
anchor
xrequest( path, settings={} )

Add a Mongrel2::Config::XRequest to the Server object with the specified path (name) and settings hash.

# File lib/mongrel2/config/server.rb, line 218
def xrequest( path, settings={} )
        self.target.save( :validate => false )

        self.log.debug "XRequest [%s]: %p" % [ path, settings ]
        self.target.add_xrequest( name: path, settings: settings )
end