class Object

Public Instance Methods

process(file) { |output, line| ... } click to toggle source
# File post-autoconf.rb, line 4
def process(file)
  puts "Post-processing #{file}"
  File.open(file) do |input|
    File.open("#{file}.pp", "w") do |output|
      input.each_line do |line|
        yield output, line
      end
    end
  end
  FileUtils.mv("#{file}.pp", "#{file}")
end
puts(line='') click to toggle source
# File rice/rubypp.rb, line 72
def puts(line='')
  $preprocessor.puts(line)
end
rubypp(input_file, output_file) click to toggle source
# File rice/rubypp.rb, line 76
def rubypp(input_file, output_file)
  input = input_file ? File.open(input_file) : $stdin
  output = output_file ? File.open(output_file, 'w') : $stdout

  success = false
  begin
    $preprocessor = Preprocessor.new(input, output, input_file || "(stdin)")
    $preprocessor.preprocess()
    success = true
  ensure
    if not success then
      File.unlink(output_file) rescue Errno::ENOENT
    end
  end
end