Top Level Namespace

Defined Under Namespace

Classes: RubyPP

Instance Method Summary collapse

Instance Method Details

#rubypp(input_file, output_file) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/rubypp.rb', line 87

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 = RubyPP.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