public Method

KnownHosts.add(host, key)

There's no documentation for this item.

Source Code

# File net/ssh/known-hosts.rb, line 84
def add(host, key)
  dir = File.dirname(source)
  Dir.mkdir(dir, 0700) if !File.exists?(dir)

  File.open(source, "a") do |file|
    buffer = Net::SSH::Transport::OSSL::Buffer.new
    buffer.write_key(key)
    blob = [buffer.to_s].pack("m*").gsub(/\s/, "")
    file.puts "#{Array(host).join(',')} #{key.ssh_type} #{blob}"
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.