Class: Pario::Cli
Constant Summary collapse
- Directories =
%w{game lib media config}
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(arguments, stdin) ⇒ Cli
constructor
A new instance of Cli.
-
#run ⇒ Object
Parse options, check arguments, then process the command.
Constructor Details
#initialize(arguments, stdin) ⇒ Cli
Returns a new instance of Cli.
14 15 16 17 |
# File 'lib/pario/cli.rb', line 14 def initialize(arguments, stdin) @command = arguments[0] @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
12 13 14 |
# File 'lib/pario/cli.rb', line 12 def arguments @arguments end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
12 13 14 |
# File 'lib/pario/cli.rb', line 12 def command @command end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
12 13 14 |
# File 'lib/pario/cli.rb', line 12 def @options end |
Instance Method Details
#run ⇒ Object
Parse options, check arguments, then process the command
20 21 22 23 24 25 26 27 |
# File 'lib/pario/cli.rb', line 20 def run if valid_pario_command? @command = arguments.delete_at(0) process_command else puts "Command not recognized." end end |