Class: DocxTemplater::Command
- Inherits:
-
Object
- Object
- DocxTemplater::Command
- Defined in:
- lib/docx_templater/command.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Command
Returns a new instance of Command.
5 6 7 8 |
# File 'lib/docx_templater/command.rb', line 5 def initialize(args) @args = args = {} end |
Class Method Details
.generate_doc(options = {}) ⇒ Object
23 24 25 |
# File 'lib/docx_templater/command.rb', line 23 def self.generate_doc( = {}) DocxTemplater.template_docx end |
Instance Method Details
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/docx_templater/command.rb', line 10 def run @opts = OptionParser.new(&method(:set_opts)) @opts.parse!(@args) process! exit 0 rescue Exception => ex raise ex if [:trace] || SystemExit === ex $stderr.print "#{ex.class}: " if ex.class != RuntimeError $stderr.puts ex. $stderr.puts ' Use --trace for backtrace.' exit 1 end |