Class: Donjon::User
- Inherits:
-
Object
- Object
- Donjon::User
- Extended by:
- ClassMethods, SharedMethods
- Includes:
- SharedMethods
- Defined in:
- lib/donjon/user.rb
Defined Under Namespace
Modules: ClassMethods, SharedMethods
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(name:, key:, repo:) ⇒ User
constructor
A new instance of User.
- #save ⇒ Object
Methods included from ClassMethods
Constructor Details
#initialize(name:, key:, repo:) ⇒ User
Returns a new instance of User.
8 9 10 11 12 13 14 |
# File 'lib/donjon/user.rb', line 8 def initialize(name:, key:, repo:) assert(key.n.num_bits == 2048) @name = name @key = key @repo = repo end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
6 7 8 |
# File 'lib/donjon/user.rb', line 6 def key @key end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/donjon/user.rb', line 6 def name @name end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
6 7 8 |
# File 'lib/donjon/user.rb', line 6 def repo @repo end |
Instance Method Details
#save ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/donjon/user.rb', line 16 def save _path_for(@name, @repo).tap do |path| path.parent.mkpath path.write @key.public_key.to_pem end self end |