Class: SugoiAliasesUpdator::Cli
- Inherits:
-
Object
- Object
- SugoiAliasesUpdator::Cli
- Defined in:
- lib/sugoi_aliases_updator/cli.rb
Constant Summary collapse
- COMMANDS =
%w(add rm del list show)
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#filepath ⇒ Object
readonly
Returns the value of attribute filepath.
-
#target_email ⇒ Object
readonly
Returns the value of attribute target_email.
Instance Method Summary collapse
- #check_input ⇒ Object
- #direction_labels ⇒ Object
-
#initialize(args) ⇒ Cli
constructor
A new instance of Cli.
Constructor Details
#initialize(args) ⇒ Cli
Returns a new instance of Cli.
7 8 9 10 11 12 |
# File 'lib/sugoi_aliases_updator/cli.rb', line 7 def initialize(args) @filepath = args[0] || '' @command = args[1] @target_email = args[2] @direction_labels = args[3] end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/sugoi_aliases_updator/cli.rb', line 3 def command @command end |
#filepath ⇒ Object (readonly)
Returns the value of attribute filepath.
3 4 5 |
# File 'lib/sugoi_aliases_updator/cli.rb', line 3 def filepath @filepath end |
#target_email ⇒ Object (readonly)
Returns the value of attribute target_email.
3 4 5 |
# File 'lib/sugoi_aliases_updator/cli.rb', line 3 def target_email @target_email end |
Instance Method Details
#check_input ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/sugoi_aliases_updator/cli.rb', line 14 def check_input display_version check_filepath check_command check_terget_email check_direction end |
#direction_labels ⇒ Object
22 23 24 25 |
# File 'lib/sugoi_aliases_updator/cli.rb', line 22 def direction_labels raise("Oops '#{@direction_labels}'") unless /(TO|FROM)=(.*)$/ =~ @direction_labels $2.split(/,\s?/) end |