Class: AocCli::Commands::KeyStore
- Inherits:
-
Object
- Object
- AocCli::Commands::KeyStore
- Defined in:
- lib/aoc_cli/commands.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #defaults ⇒ Object
- #exec ⇒ Object
-
#initialize(args) ⇒ KeyStore
constructor
A new instance of KeyStore.
- #respond ⇒ Object
Constructor Details
#initialize(args) ⇒ KeyStore
Returns a new instance of KeyStore.
5 6 7 8 |
# File 'lib/aoc_cli/commands.rb', line 5 def initialize(args) args = defaults.merge(args).compact @user, @key = args[:user], args[:key] end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
4 5 6 |
# File 'lib/aoc_cli/commands.rb', line 4 def key @key end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'lib/aoc_cli/commands.rb', line 4 def user @user end |
Instance Method Details
#defaults ⇒ Object
16 17 18 |
# File 'lib/aoc_cli/commands.rb', line 16 def defaults { user:"main" } end |
#exec ⇒ Object
9 10 11 12 |
# File 'lib/aoc_cli/commands.rb', line 9 def exec Files::Config::Cookie.store(user:user, key:key) self end |
#respond ⇒ Object
13 14 15 |
# File 'lib/aoc_cli/commands.rb', line 13 def respond puts "Key added successfully" end |