Module: BibTeX::Options::ApplicationOptions
- Defined in:
- lib/rbibtex/transform.rb
Overview
Module to be included into an OptionParser parser. Creates output, help and version switches.
This depends on a VERSION Constant being declared in the parser.
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
12 13 14 |
# File 'lib/rbibtex/transform.rb', line 12 def output @output end |
Instance Method Details
#initialize ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rbibtex/transform.rb', line 14 def initialize super() @output = STDOUT self.on("-o", "--output FILENAME", String, "Set the output filename. Writes to stdout if nothing is given") { | v | @output = File.open(v, 'w') } self.separator "" self.on("-?", "--help", "Show this help") { puts self; exit } self.on("-v", "--version", "Output version number and exit") { puts VERSION; exit } end |