Class: Tunnel::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/tunnel/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#hostObject (readonly)

Returns the value of attribute host.



3
4
5
# File 'lib/tunnel/target.rb', line 3

def host
  @host
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/tunnel/target.rb', line 3

def name
  @name
end

#usernameObject (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

Returns:

  • (Boolean)


16
17
18
# File 'lib/tunnel/target.rb', line 16

def has_name?( name )
  @name==name
end