Class: AocCli::Commands::DefaultAlias
- Inherits:
-
Object
- Object
- AocCli::Commands::DefaultAlias
- Defined in:
- lib/aoc_cli/commands.rb
Instance Attribute Summary collapse
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(args) ⇒ DefaultAlias
constructor
A new instance of DefaultAlias.
- #respond ⇒ Object
Constructor Details
#initialize(args) ⇒ DefaultAlias
Returns a new instance of DefaultAlias.
104 105 106 107 |
# File 'lib/aoc_cli/commands.rb', line 104 def initialize(args) @user = args[:user] @mode = user.nil? ? :get : :set end |
Instance Attribute Details
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
103 104 105 |
# File 'lib/aoc_cli/commands.rb', line 103 def mode @mode end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
103 104 105 |
# File 'lib/aoc_cli/commands.rb', line 103 def user @user end |
Instance Method Details
#exec ⇒ Object
108 109 110 111 |
# File 'lib/aoc_cli/commands.rb', line 108 def exec set if mode == :set && alias_valid self end |
#respond ⇒ Object
112 113 114 115 116 |
# File 'lib/aoc_cli/commands.rb', line 112 def respond case mode when :get then current when :set then update end end |