Class: Net::SSH::HostKeys

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/net/ssh/known_hosts.rb

Overview

Represents the result of a search in known hosts see search_for

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host_keys, host, known_hosts, options = {}) ⇒ HostKeys

Returns a new instance of HostKeys.


74
75
76
77
78
79
# File 'lib/net/ssh/known_hosts.rb', line 74

def initialize(host_keys, host, known_hosts, options = {})
  @host_keys = host_keys
  @host = host
  @known_hosts = known_hosts
  @options = options
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.


72
73
74
# File 'lib/net/ssh/known_hosts.rb', line 72

def host
  @host
end

Instance Method Details

#add_host_key(key) ⇒ Object


81
82
83
84
# File 'lib/net/ssh/known_hosts.rb', line 81

def add_host_key(key)
  @known_hosts.add(@host, key, @options)
  @host_keys.push(key)
end

#each(&block) ⇒ Object


86
87
88
# File 'lib/net/ssh/known_hosts.rb', line 86

def each(&block)
  @host_keys.each(&block)
end

#empty?Boolean

Returns:

  • (Boolean)

90
91
92
# File 'lib/net/ssh/known_hosts.rb', line 90

def empty?
  @host_keys.empty?
end