Class: Tunnel::Target
- Inherits:
-
Object
- Object
- Tunnel::Target
- Defined in:
- lib/tunnel/target.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #each_forward(&block) ⇒ Object
- #forward_port(port, server = 'localhost') ⇒ Object
- #has_name?(name) ⇒ Boolean
-
#initialize(name, host, username) ⇒ Target
constructor
A new instance of Target.
Constructor Details
#initialize(name, host, username) ⇒ Target
Returns a new instance of Target.
5 6 7 8 9 10 |
# File 'lib/tunnel/target.rb', line 5 def initialize( name, host, username ) @name = name @host = host @username = username @forwards = [] end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
3 4 5 |
# File 'lib/tunnel/target.rb', line 3 def host @host end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/tunnel/target.rb', line 3 def name @name end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/tunnel/target.rb', line 3 def username @username end |
Instance Method Details
#each_forward(&block) ⇒ Object
20 21 22 |
# File 'lib/tunnel/target.rb', line 20 def each_forward( &block ) @forwards.each { |fwd| yield fwd } end |
#forward_port(port, server = 'localhost') ⇒ Object
12 13 14 |
# File 'lib/tunnel/target.rb', line 12 def forward_port( port, server='localhost' ) @forwards << [ server, port ] end |
#has_name?(name) ⇒ Boolean
16 17 18 |
# File 'lib/tunnel/target.rb', line 16 def has_name?( name ) @name==name end |