Class: Citrus::Components::Remote

Inherits:
Component
  • Object
show all
Includes:
Utils::PathUtil
Defined in:
lib/citrus/components/remote.rb

Overview

Remote

Instance Method Summary collapse

Methods included from Utils::PathUtil

#get_handler_path, #get_sys_remote_path, #get_user_remote_path, #remote_path_record

Constructor Details

#initialize(app, args = {}) ⇒ Remote

Initialize the component

Parameters:

  • app (Object)
  • args (Hash) (defaults to: {})


25
26
27
28
29
30
# File 'lib/citrus/components/remote.rb', line 25

def initialize app, args={}
  args[:buffer_msg] = args[:buffer_msg] || false
  args[:interval]  = args[:interval] || 0.03
  @app = app
  @args = args
end

Instance Method Details

#start(&block) ⇒ Object

Start the component



33
34
35
36
37
38
39
40
41
42
# File 'lib/citrus/components/remote.rb', line 33

def start &block
  @args[:port] = @app.cur_server[:port]
  @args[:paths] = get_remote_paths
  @args[:context] = @app

  @remote = CitrusRpc::RpcServer::Server.new @args
  @remote.start

  EM.next_tick { block_given? and yield }
end

#stop(force = false, &block) ⇒ Object

Stop the component

Parameters:

  • force (Boolean) (defaults to: false)


47
48
49
50
# File 'lib/citrus/components/remote.rb', line 47

def stop force=false, &block
  @remote.stop force
  EM.next_tick { block_given? and yield }
end