Class: EssCee::Host

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname) ⇒ Host

Returns a new instance of Host.



5
6
7
# File 'lib/host.rb', line 5

def initialize(hostname)
  @hostname = hostname
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname.



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

def hostname
  @hostname
end

Instance Method Details

#service(name) ⇒ Object



14
15
16
# File 'lib/host.rb', line 14

def service(name)
  services.find {|service| service.name == name}
end

#servicesObject



9
10
11
12
# File 'lib/host.rb', line 9

def services
 responses = ResponseParser.get_services(%x[sc \\\\#{@hostname} query state= all])
 responses.map { |service| EssCee::Service.new(@hostname, service) }
end