Class: Mongrel2::Config::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/mongrel2/config/handler.rb

Overview

Mongrel2 Handler configuration class

Constant Summary collapse

VALID_SPEC_SCHEMES =

The list of 0mq transports Mongrel2 can use; “You need to use the ZeroMQ syntax for configuring them, but this means with one configuration format you can use handlers that are using UDP, TCP, Unix, or PGM transports.” Note that I’m assuming by ‘udp’ Zed means ‘epgm’, as I can’t find any udp 0mq transport.

%w[epgm tcp ipc pgm]
VALID_PROTOCOLS =

The list of valid protocols – handler.h: typedef enum { HANDLER_PROTO_JSON, HANDLER_PROTO_TNET } handler_protocol_t;

%w[json tnetstring]

Instance Method Summary collapse

Instance Method Details

#routesObject

The routes that refer to this Handler



26
# File 'lib/mongrel2/config/handler.rb', line 26

one_to_many :routes, :key => :target_id, :conditions => { target_type: 'handler' }

#to_sObject

Return a description of the handler.



63
64
65
66
67
68
69
70
71
# File 'lib/mongrel2/config/handler.rb', line 63

def to_s
  return "Handler `%s' %s <-> %s {%s}%s" % [
    self.send_ident,
    self.recv_spec,
    self.send_spec,
    self.protocol,
    self.raw_payload.nonzero? ? ' (raw)' : '',
  ]
end

#validateObject

Validate the object prior to saving it.



54
55
56
57
58
59
# File 'lib/mongrel2/config/handler.rb', line 54

def validate
  self.validate_idents
  self.validate_specs
  self.validate_protocol
  self.validate_uniqueness
end