Class: BitClust::Subcommands::PreprocCommand
- Inherits:
-
BitClust::Subcommand
- Object
- BitClust::Subcommand
- BitClust::Subcommands::PreprocCommand
- Defined in:
- lib/bitclust/subcommands/preproc_command.rb
Instance Method Summary collapse
- #exec(argv, options) ⇒ Object
-
#initialize ⇒ PreprocCommand
constructor
A new instance of PreprocCommand.
Methods inherited from BitClust::Subcommand
#align_progress_bar_title, #error, #help, #option_error, #parse, #srcdir_root
Constructor Details
#initialize ⇒ PreprocCommand
Returns a new instance of PreprocCommand.
11 12 13 14 15 16 17 18 19 |
# File 'lib/bitclust/subcommands/preproc_command.rb', line 11 def initialize super @params = { "version" => "2.0.0" } @parser. = "Usage: #{File.basename($0, '.*')} <file>..." @parser.on('--param=KVPAIR', 'Set parameter by key/value pair.') {|pair| key, value = pair.split('=', 2) @params[key] = value } end |
Instance Method Details
#exec(argv, options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bitclust/subcommands/preproc_command.rb', line 21 def exec(argv, ) argv.each do |path| File.open(path) {|file| Preprocessor.wrap(file, @params).each do |line| puts line end } end rescue WriterError => err $stderr.puts err. exit 1 end |