Class: Eve::FileNotifierServer
- Inherits:
-
Object
- Object
- Eve::FileNotifierServer
- Defined in:
- lib/eve/file_notifier_server.rb
Instance Attribute Summary collapse
-
#appid ⇒ Object
Returns the value of attribute appid.
-
#callbacks ⇒ Object
Returns the value of attribute callbacks.
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#inits ⇒ Object
Returns the value of attribute inits.
-
#port ⇒ Object
Returns the value of attribute port.
-
#server ⇒ Object
Returns the value of attribute server.
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
- #app ⇒ Object
- #file_modified ⇒ Object
-
#initialize(connection, data) ⇒ FileNotifierServer
constructor
A new instance of FileNotifierServer.
- #post_init ⇒ Object
Constructor Details
#initialize(connection, data) ⇒ FileNotifierServer
Returns a new instance of FileNotifierServer.
7 8 9 10 11 12 13 14 15 |
# File 'lib/eve/file_notifier_server.rb', line 7 def initialize(connection,data) @connection = connection @server = data[:server] @port = data[:port] @source = data[:source] @appid = data[:appid] @callbacks = data[:callbacks] || [] @inits = data[:inits] || [] end |
Instance Attribute Details
#appid ⇒ Object
Returns the value of attribute appid.
5 6 7 |
# File 'lib/eve/file_notifier_server.rb', line 5 def appid @appid end |
#callbacks ⇒ Object
Returns the value of attribute callbacks.
5 6 7 |
# File 'lib/eve/file_notifier_server.rb', line 5 def callbacks @callbacks end |
#connection ⇒ Object
Returns the value of attribute connection.
5 6 7 |
# File 'lib/eve/file_notifier_server.rb', line 5 def connection @connection end |
#inits ⇒ Object
Returns the value of attribute inits.
5 6 7 |
# File 'lib/eve/file_notifier_server.rb', line 5 def inits @inits end |
#port ⇒ Object
Returns the value of attribute port.
5 6 7 |
# File 'lib/eve/file_notifier_server.rb', line 5 def port @port end |
#server ⇒ Object
Returns the value of attribute server.
5 6 7 |
# File 'lib/eve/file_notifier_server.rb', line 5 def server @server end |
#source ⇒ Object
Returns the value of attribute source.
5 6 7 |
# File 'lib/eve/file_notifier_server.rb', line 5 def source @source end |
Class Method Details
.handle_args(args) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/eve/file_notifier_server.rb', line 17 def self.handle_args(args) { :server => Application.extract_arg("--server",args,nil), :port => Application.extract_arg("--port",args,nil), :source => Application.extract_arg("--source",args,nil), :appid => Application.extract_arg("--id",args,nil), :callbacks => Application.extract_arg("--callback",args,[]), :inits => Application.extract_arg("--init",args,[]) } end |
Instance Method Details
#app ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/eve/file_notifier_server.rb', line 28 def app if @connection.app.nil? display = :stdio @connection.app = Eve::Application.new(:display => display, :system_calls_display => { :filename => "./eve_system_calls.log" }) end @connection.app end |
#file_modified ⇒ Object
45 46 47 |
# File 'lib/eve/file_notifier_server.rb', line 45 def file_modified @callbacks.each { |cb| app.cmd(cb) } end |
#post_init ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/eve/file_notifier_server.rb', line 36 def post_init if @server.nil? app.cmd("appid #{@appid}") else app.cmd("event #{@server}:#{@port}") end @inits.each { |x| app.cmd(x) } end |