Class: Eve::EventServer
- Inherits:
-
Object
- Object
- Eve::EventServer
- Defined in:
- lib/eve/event_server.rb
Instance Attribute Summary collapse
-
#appid ⇒ Object
Returns the value of attribute appid.
-
#connection ⇒ Object
Returns the value of attribute connection.
Class Method Summary collapse
Instance Method Summary collapse
- #app ⇒ Object
-
#initialize(connection, data) ⇒ EventServer
constructor
A new instance of EventServer.
- #post_init ⇒ Object
- #receive_data(data) ⇒ Object
Constructor Details
#initialize(connection, data) ⇒ EventServer
Returns a new instance of EventServer.
34 35 36 37 |
# File 'lib/eve/event_server.rb', line 34 def initialize(connection,data) @connection = connection @appid = data[:appid] end |
Instance Attribute Details
#appid ⇒ Object
Returns the value of attribute appid.
32 33 34 |
# File 'lib/eve/event_server.rb', line 32 def appid @appid end |
#connection ⇒ Object
Returns the value of attribute connection.
32 33 34 |
# File 'lib/eve/event_server.rb', line 32 def connection @connection end |
Class Method Details
.handle_args(args) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/eve/event_server.rb', line 39 def self.handle_args(args) { :server => Application.extract_arg("--server",args,"0.0.0.0"), :port => Application.extract_arg("--port",args,"4848"), :appid => Application.extract_arg("--id",args,"myeve") } end |
Instance Method Details
#app ⇒ Object
47 48 49 50 51 52 |
# File 'lib/eve/event_server.rb', line 47 def app if @connection.app.nil? @connection.app = Eve::Application.new(:display => { :event_machine => @connection }, :system_calls_display => { :filename => "./eve_server_calls.log" }) end @connection.app end |
#post_init ⇒ Object
54 55 56 |
# File 'lib/eve/event_server.rb', line 54 def post_init app.cmd("appid #{@appid}") end |
#receive_data(data) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/eve/event_server.rb', line 58 def receive_data(data) result = app.cmd(data) @connection.close_connection if result[:status] == :exited @connection.send_data("#{app.id}> ") result end |