class AuthorizedKeys::Key

Attributes

comment[RW]
content[RW]
options[RW]

Public Class Methods

new(key_string) click to toggle source
# File lib/authorized_keys/key.rb, line 16
def initialize(key_string)
  options, self.content, self.comment = *Components.extract(key_string)

  raise BadKeyError.new(key_string) unless self.content

  self.options = options.split(/,/)
end

Public Instance Methods

==(key) click to toggle source
# File lib/authorized_keys/key.rb, line 29
def ==(key)
  key = self.class.new(key) if key.is_a?(String)
  content == key.content
end
to_s() click to toggle source
# File lib/authorized_keys/key.rb, line 24
def to_s
  options = self.options.join(",") unless self.options.empty?
  [options, content, comment].compact.join(" ")
end