Class: Gift::Cli
- Inherits:
-
Object
- Object
- Gift::Cli
- Defined in:
- lib/cli.rb
Instance Attribute Summary collapse
-
#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
Constructor Details
#initialize(arguments, stdin) ⇒ Cli
Returns a new instance of Cli.
17 18 19 20 21 22 23 24 25 |
# File 'lib/cli.rb', line 17 def initialize(arguments, stdin) @arguments = arguments @stdin = stdin # Set defaults @options = OpenStruct.new @options.verbose = false @options.quiet = false end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
15 16 17 |
# File 'lib/cli.rb', line 15 def @options end |
Instance Method Details
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cli.rb', line 27 def run if puts "Start at #{DateTime.now}\n\n" if @options.verbose if @options.verbose # [Optional] process_arguments process_command puts "\nFinished at #{DateTime.now}" if @options.verbose else output_usage end return 0 end |