Class: HTML2TeX::CLI
- Inherits:
-
Object
- Object
- HTML2TeX::CLI
- Defined in:
- lib/html2tex/cli.rb
Constant Summary collapse
- CleanExit =
Class.new(RuntimeError)
- DirtyExit =
Class.new(RuntimeError)
Instance Attribute Summary collapse
-
#input_file ⇒ Object
readonly
Returns the value of attribute input_file.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
Instance Method Summary collapse
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #parse ⇒ Object
- #usage ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
10 11 12 13 |
# File 'lib/html2tex/cli.rb', line 10 def initialize(argv) @argv = argv @options = {} end |
Instance Attribute Details
#input_file ⇒ Object (readonly)
Returns the value of attribute input_file.
8 9 10 |
# File 'lib/html2tex/cli.rb', line 8 def input_file @input_file end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/html2tex/cli.rb', line 8 def @options end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
8 9 10 |
# File 'lib/html2tex/cli.rb', line 8 def output_file @output_file end |
Instance Method Details
#parse ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/html2tex/cli.rb', line 19 def parse parser.parse!(@argv) unless @input_file = @argv[0] raise DirtyExit end @output_file = @argv[1] || @input_file.sub(/\.[^\.]+$|$/, ".tex") end |
#usage ⇒ Object
15 16 17 |
# File 'lib/html2tex/cli.rb', line 15 def usage parser.to_s end |