class Courgette::FileToSexpr

Public Class Methods

new(p=nil) click to toggle source
# File lib/courgette/file_to_sexpr.rb, line 5
def initialize p=nil
  @parser = p || default_parser
end

Public Instance Methods

convert(filename) click to toggle source
# File lib/courgette/file_to_sexpr.rb, line 13
def convert filename
  contents = File.read filename

  begin
    @parser.parse contents
  rescue Parser::SyntaxError => e
    $stderr.puts "Error parsing #{filename}: #{e} (file ignored)"
  end
end
default_parser() click to toggle source
# File lib/courgette/file_to_sexpr.rb, line 9
def default_parser
  Parser::CurrentRuby
end