Class: Tex2id::CLI
- Inherits:
-
Object
- Object
- Tex2id::CLI
- Defined in:
- lib/tex2id/cli.rb
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
Class Method Summary collapse
Instance Method Summary collapse
- #help(io) ⇒ Object
-
#initialize(argv) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(argv) ⇒ CLI
Returns a new instance of CLI.
9 10 11 12 |
# File 'lib/tex2id/cli.rb', line 9 def initialize(argv) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
14 15 16 |
# File 'lib/tex2id/cli.rb', line 14 def argv @argv end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
14 15 16 |
# File 'lib/tex2id/cli.rb', line 14 def output_file @output_file end |
#source_file ⇒ Object (readonly)
Returns the value of attribute source_file.
14 15 16 |
# File 'lib/tex2id/cli.rb', line 14 def source_file @source_file end |
Class Method Details
.run(argv) ⇒ Object
5 6 7 |
# File 'lib/tex2id/cli.rb', line 5 def self.run(argv) self.new(argv).run end |
Instance Method Details
#help(io) ⇒ Object
29 30 31 32 33 |
# File 'lib/tex2id/cli.rb', line 29 def help(io) io.puts "Usage: \#{$0} <source_file> [<output_file>]\n END_HELP\nend\n" |
#run ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tex2id/cli.rb', line 16 def run unless source_file help($stdout) return 1 end converter = Tex2id::Converter.new(source, only_fix_md2inao: @only_fix_md2inao) with_output_file_io do |io| io.write converter.convert end 0 end |