Class: Synack::Server
- Inherits:
-
Object
- Object
- Synack::Server
- Defined in:
- lib/synack/server.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ host: 'localhost', port: 11113 }
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Class Method Summary collapse
-
.start(options = {}) ⇒ Object
Class methods ================================================================================.
- .stop ⇒ Object
Instance Method Summary collapse
-
#sanitize(message) ⇒ Object
Instance methods =============================================================================.
- #say(message) ⇒ Object
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
13 14 15 |
# File 'lib/synack/server.rb', line 13 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
13 14 15 |
# File 'lib/synack/server.rb', line 13 def port @port end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
13 14 15 |
# File 'lib/synack/server.rb', line 13 def socket @socket end |
Class Method Details
.start(options = {}) ⇒ Object
Class methods ================================================================================
17 18 19 20 21 22 23 24 25 |
# File 'lib/synack/server.rb', line 17 def self.start(={}) = DEFAULT_OPTIONS.merge() @host = [:host] @port = [:port].to_i @@server = Synack::Server.new puts "Synack server running. Fire at will." ::DRb.start_service("druby://#{@host}:#{@port}", @@server) ::DRb.thread.join end |
.stop ⇒ Object
27 28 29 |
# File 'lib/synack/server.rb', line 27 def self.stop ::DRb.stop_service end |
Instance Method Details
#sanitize(message) ⇒ Object
Instance methods =============================================================================
33 34 35 |
# File 'lib/synack/server.rb', line 33 def sanitize() && .gsub(/[^0-9A-z\.\-\'\, ]/, '_') end |
#say(message) ⇒ Object
37 38 39 40 |
# File 'lib/synack/server.rb', line 37 def say() puts system "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -message \"#{sanitize()}\"" end |