Class: Sshster::ArgvParser
- Inherits:
-
Object
- Object
- Sshster::ArgvParser
- Defined in:
- lib/sshster/argv_parser.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#help ⇒ Object
readonly
Returns the value of attribute help.
Instance Method Summary collapse
-
#initialize(argv) ⇒ ArgvParser
constructor
A new instance of ArgvParser.
- #parse ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(argv) ⇒ ArgvParser
Returns a new instance of ArgvParser.
5 6 7 |
# File 'lib/sshster/argv_parser.rb', line 5 def initialize(argv) @argv = argv end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/sshster/argv_parser.rb', line 3 def command @command end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/sshster/argv_parser.rb', line 3 def config @config end |
#help ⇒ Object (readonly)
Returns the value of attribute help.
3 4 5 |
# File 'lib/sshster/argv_parser.rb', line 3 def help @help end |
Instance Method Details
#parse ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/sshster/argv_parser.rb', line 9 def parse = parse_argv(@argv) @config = ['-c'] @help = ['-h'] @command = detect_command() self end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/sshster/argv_parser.rb', line 17 def valid? !@command.nil? && valid_commands.include?(@command) end |