Class: Armada::Connection::Remote
- Inherits:
-
Object
- Object
- Armada::Connection::Remote
- Defined in:
- lib/armada/connection/remote.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#gateway ⇒ Object
readonly
Returns the value of attribute gateway.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host, port = nil, gateway_host = nil, gateway_user = nil) ⇒ Remote
constructor
A new instance of Remote.
- #initialize_gateway! ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(host, port = nil, gateway_host = nil, gateway_user = nil) ⇒ Remote
Returns a new instance of Remote.
6 7 8 9 10 11 12 |
# File 'lib/armada/connection/remote.rb', line 6 def initialize(host, port = nil, gateway_host = nil, gateway_user = nil) @host, @port = host.split(":") @port = port ||= @port @gateway_host = gateway_host @gateway_user = gateway_user initialize_gateway! end |
Instance Attribute Details
#gateway ⇒ Object (readonly)
Returns the value of attribute gateway.
5 6 7 |
# File 'lib/armada/connection/remote.rb', line 5 def gateway @gateway end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
5 6 7 |
# File 'lib/armada/connection/remote.rb', line 5 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
5 6 7 |
# File 'lib/armada/connection/remote.rb', line 5 def port @port end |
Instance Method Details
#initialize_gateway! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/armada/connection/remote.rb', line 18 def initialize_gateway! if @gateway_host @gateway = Net::SSH::Gateway.new(@gateway_host, @gateway_user) @tunneled_port = @gateway.open(@host, @port) end end |
#to_s ⇒ Object
14 15 16 |
# File 'lib/armada/connection/remote.rb', line 14 def to_s "#{@host}:#{@port}" end |