Class: Cow::Tmpl::Server
- Inherits:
-
Object
show all
- Defined in:
- lib/cow/plugins/tmpl.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(_hostname, _snmp_community) ⇒ Server
Returns a new instance of Server.
31
32
|
# File 'lib/cow/plugins/tmpl.rb', line 31
def initialize
end
|
Instance Attribute Details
#hostname ⇒ Object
Returns the value of attribute hostname.
25
26
27
|
# File 'lib/cow/plugins/tmpl.rb', line 25
def hostname
@hostname
end
|
Instance Method Details
#connect(_port, _user = nil) ⇒ Object
72
73
74
75
76
77
78
|
# File 'lib/cow/plugins/tmpl.rb', line 72
def connect(_port, _user = nil)
if _user
system(connect_command(_port, _user))
else
system(connect_command(_port))
end
end
|
#connect_command(_port, _user = ) ⇒ Object
68
69
70
|
# File 'lib/cow/plugins/tmpl.rb', line 68
def connect_command(_port, _user = ENV['USER'])
raise NotImplementedError
end
|
#find(_portname) ⇒ Object
62
63
64
65
66
|
# File 'lib/cow/plugins/tmpl.rb', line 62
def find(_portname)
_ports = []
ports.each{|p| _ports << p if p.name.include?(_portname) }
return _ports
end
|
#port(_port) ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/cow/plugins/tmpl.rb', line 51
def port(_port)
case _port
when Fixnum
ports.each{|p| return p if p.port == _port}
when String
ports.each{|p| return p if p.name == _port}
end
nil
end
|
#ports ⇒ Object
41
42
43
44
45
|
# File 'lib/cow/plugins/tmpl.rb', line 41
def ports
update_ports unless @ports
@ports
end
|
#update_ports ⇒ Object
47
48
49
|
# File 'lib/cow/plugins/tmpl.rb', line 47
def update_ports
@ports = get_ports
end
|