Class: Barrister::IntraProcessContainer

Inherits:
Object
  • Object
show all
Defined in:
lib/barrister-intraprocess.rb

Instance Method Summary collapse

Constructor Details

#initialize(json_path, handlers) ⇒ IntraProcessContainer

Returns a new instance of IntraProcessContainer.



7
8
9
10
11
12
13
14
15
# File 'lib/barrister-intraprocess.rb', line 7

def initialize(json_path, handlers)
  contract = Barrister::contract_from_file(json_path)
  @server  = Barrister::Server.new(contract)

  # register each provided handler
  handlers.each do |handler_klass|
    @server.add_handler handler_klass.to_s, handler_klass.new
  end
end

Instance Method Details

#process(message) ⇒ Object



17
18
19
# File 'lib/barrister-intraprocess.rb', line 17

def process(message)
  @server.handle(message)
end