class SSHKit::Backend::Netssh::KnownHosts

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/sshkit/backends/netssh/known_hosts.rb, line 115
def initialize
  super()
  @files = {}
end

Public Instance Methods

add(*args) click to toggle source
# File lib/sshkit/backends/netssh/known_hosts.rb, line 127
def add(*args)
  ::Net::SSH::KnownHosts.add(*args)
  synchronize { @files = {} }
end
search_for(host, options = {}) click to toggle source
# File lib/sshkit/backends/netssh/known_hosts.rb, line 120
def search_for(host, options = {})
  keys = ::Net::SSH::KnownHosts.hostfiles(options).map do |path|
    known_hosts_file(path).keys_for(host)
  end.flatten
  ::Net::SSH::HostKeys.new(keys, host, self, options)
end

Private Instance Methods

known_hosts_file(path) click to toggle source
# File lib/sshkit/backends/netssh/known_hosts.rb, line 134
def known_hosts_file(path)
  @files[path] || synchronize { @files[path] ||= KnownHostsKeys.new(path) }
end