Class: ApCommand::Application
- Inherits:
-
Object
- Object
- ApCommand::Application
- Defined in:
- lib/ap_command.rb
Overview
ap_command main class.
Class Method Summary collapse
-
.invoke(argv) ⇒ void
execute application shortcut.
Instance Method Summary collapse
-
#run(argv) ⇒ void
execute application.
Class Method Details
.invoke(argv) ⇒ void
This method returns an undefined value.
execute application shortcut.
40 41 42 |
# File 'lib/ap_command.rb', line 40 def self.invoke(argv) self.new.run(argv) end |
Instance Method Details
#run(argv) ⇒ void
This method returns an undefined value.
execute application.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ap_command.rb', line 20 def run(argv) opt = OptionParser.new opt.on('-v', '--version') {|v| version} opt.on('-h', '--help') {|v| usage} opt.parse!(argv) path = argv.first.to_s usage("File NotFound(path=#{path})") unless(File.exists?(path)) begin awesome(JSON.parse(File.read(path))) rescue JSON::ParserError => e usage("Error: #{e.class} message => #{e.}") end end |