Class: App
- Inherits:
-
Object
- Object
- App
- Defined in:
- lib/scensus-utils.rb
Constant Summary collapse
- VERSION =
'0.2.0'
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(arguments, stdin) ⇒ App
constructor
A new instance of App.
-
#run ⇒ Object
Parse options, check arguments, then process the command.
Constructor Details
#initialize(arguments, stdin) ⇒ App
Returns a new instance of App.
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/scensus-utils.rb', line 57 def initialize(arguments, stdin) @arguments = arguments @stdin = stdin # Set defaults @options = OpenStruct.new @options.verbose = false @options.quiet = false @options.simplify_p = true @options.output_file = 'output.js' end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
55 56 57 |
# File 'lib/scensus-utils.rb', line 55 def @options end |
Instance Method Details
#run ⇒ Object
Parse options, check arguments, then process the command
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/scensus-utils.rb', line 70 def run if && arguments_valid? 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 end |