Class: M2Config::Handler

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

Constant Summary collapse

ID_REGEX =
/^[-a-zA-Z0-9]+$/

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ Handler

Returns a new instance of Handler.

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
14
15
16
# File 'lib/m2config/handler.rb', line 7

def initialize( fields )
  raise ArgumentError, "The send and receive endpoints can not be the same" if
    fields[:send_spec] == fields[:recv_spec]
  raise ArgumentError, "Handler send and recv IDs must only use -a-zA-Z0-9" if
    !(fields[:send_ident] =~ ID_REGEX &&
     fields[:send_ident] =~ ID_REGEX)
  fields[:recv_ident] ||= ""
  super(fields, false)
  save
end

Instance Method Details

#typeObject



18
19
20
# File 'lib/m2config/handler.rb', line 18

def type
  "handler"
end