Class: AuthorizedKeys::Key
- Inherits:
-
Object
- Object
- AuthorizedKeys::Key
- Defined in:
- lib/authorized_keys/key.rb
Defined Under Namespace
Modules: Components
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#content ⇒ Object
Returns the value of attribute content.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #==(key) ⇒ Object
-
#initialize(key_string) ⇒ Key
constructor
A new instance of Key.
- #to_s ⇒ Object
Constructor Details
#initialize(key_string) ⇒ Key
Returns a new instance of Key.
16 17 18 19 20 21 22 |
# File 'lib/authorized_keys/key.rb', line 16 def initialize(key_string) , self.content, self.comment = *Components.extract(key_string) raise BadKeyError.new(key_string) unless self.content self. = .split(/,/) end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
14 15 16 |
# File 'lib/authorized_keys/key.rb', line 14 def comment @comment end |
#content ⇒ Object
Returns the value of attribute content.
14 15 16 |
# File 'lib/authorized_keys/key.rb', line 14 def content @content end |
#options ⇒ Object
Returns the value of attribute options.
14 15 16 |
# File 'lib/authorized_keys/key.rb', line 14 def @options end |
Instance Method Details
#==(key) ⇒ Object
29 30 31 32 |
# 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 ⇒ Object
24 25 26 27 |
# File 'lib/authorized_keys/key.rb', line 24 def to_s = self..join(",") unless self..empty? [, content, comment].compact.join(" ") end |