Class: Gaptool::Host

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Host

Returns a new instance of Host.



26
27
28
29
# File 'lib/gaptool_client/host.rb', line 26

def initialize(node)
  super(node['hostname'])
  @info = node
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(attr, *args, &_block) ⇒ Object



31
32
33
# File 'lib/gaptool_client/host.rb', line 31

def method_missing(attr, *args, &_block)
  @info[attr] || super
end

Instance Attribute Details

#infoObject (readonly)

Returns the value of attribute info.



24
25
26
# File 'lib/gaptool_client/host.rb', line 24

def info
  @info
end

Instance Method Details

#[](attr) ⇒ Object



35
36
37
# File 'lib/gaptool_client/host.rb', line 35

def [](attr)
  @info[attr]
end

#handlerObject



43
44
45
# File 'lib/gaptool_client/host.rb', line 43

def handler
  InteractionHandler.new(name)
end

#nameObject



39
40
41
# File 'lib/gaptool_client/host.rb', line 39

def name
  @name ||= Gaptool::API.get_host(@info)
end