Class: RakeUp::Utilities::PortCheck
- Inherits:
-
Object
- Object
- RakeUp::Utilities::PortCheck
- Defined in:
- lib/rakeup/utilities/port_check.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
- #closed? ⇒ Boolean
-
#initialize(host, port) ⇒ PortCheck
constructor
A new instance of PortCheck.
- #open? ⇒ Boolean
- #run ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(host, port) ⇒ PortCheck
Returns a new instance of PortCheck.
9 10 11 12 |
# File 'lib/rakeup/utilities/port_check.rb', line 9 def initialize(host, port) @host = host @port = port end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
7 8 9 |
# File 'lib/rakeup/utilities/port_check.rb', line 7 def error @error end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/rakeup/utilities/port_check.rb', line 7 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
7 8 9 |
# File 'lib/rakeup/utilities/port_check.rb', line 7 def port @port end |
Instance Method Details
#closed? ⇒ Boolean
18 19 20 |
# File 'lib/rakeup/utilities/port_check.rb', line 18 def closed? @status == false end |
#open? ⇒ Boolean
14 15 16 |
# File 'lib/rakeup/utilities/port_check.rb', line 14 def open? @status == true end |
#run ⇒ Object
22 23 24 |
# File 'lib/rakeup/utilities/port_check.rb', line 22 def run @status = run_check end |
#to_s ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/rakeup/utilities/port_check.rb', line 26 def to_s if open? "Found process listening on #{host}:#{port}" else "Unable to connect to process on #{host}:#{port}: #{error}" end end |