Class: Net::SSH::HostKeyEntries::PubKey
- Inherits:
-
Object
- Object
- Net::SSH::HostKeyEntries::PubKey
show all
- Defined in:
- lib/net/ssh/known_hosts.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(key, comment: nil) ⇒ PubKey
Returns a new instance of PubKey.
14
15
16
17
|
# File 'lib/net/ssh/known_hosts.rb', line 14
def initialize(key, comment: nil)
@key = key
@comment =
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
35
36
37
38
39
40
41
42
|
# File 'lib/net/ssh/known_hosts.rb', line 35
def method_missing(name, *args, &block)
return super unless @key.respond_to?(name)
raise NoMethodError.new(
"undefined method `#{name}' for #{self.class}; call it on #key, the wrapped public key",
name
)
end
|
Instance Attribute Details
#key ⇒ Object
The public key itself, e.g. an OpenSSL::PKey::PKey.
12
13
14
|
# File 'lib/net/ssh/known_hosts.rb', line 12
def key
@key
end
|
Instance Method Details
#matches_key?(server_key) ⇒ Boolean
31
32
33
|
# File 'lib/net/ssh/known_hosts.rb', line 31
def matches_key?(server_key)
@key.ssh_type == server_key.ssh_type && @key.to_blob == server_key.to_blob
end
|
#respond_to_missing?(_name, _include_private = false) ⇒ Boolean
44
45
46
|
# File 'lib/net/ssh/known_hosts.rb', line 44
def respond_to_missing?(_name, _include_private = false)
false
end
|
#ssh_type ⇒ Object
19
20
21
|
# File 'lib/net/ssh/known_hosts.rb', line 19
def ssh_type
@key.ssh_type
end
|
#ssh_types ⇒ Object
23
24
25
|
# File 'lib/net/ssh/known_hosts.rb', line 23
def ssh_types
[ssh_type]
end
|
#to_blob ⇒ Object
27
28
29
|
# File 'lib/net/ssh/known_hosts.rb', line 27
def to_blob
@key.to_blob
end
|