Module: CVGen

Defined in:
lib/cvgen.rb,
lib/cvgen/exec.rb,
lib/cvgen/parser.rb,
lib/cvgen/converter.rb

Defined Under Namespace

Modules: Exec Classes: Converter, ErbContext, Parser

Constant Summary collapse

FEATURES_OPTION =
'features'.freeze

Class Method Summary collapse

Class Method Details

.generate(source, opts = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/cvgen.rb', line 10

def self.generate source, opts={}

  source = Erubis::Eruby.new(source, :bufvar => '@output_buffer').evaluate(ErbContext.new(opts.fetch(FEATURES_OPTION, [])))

  if opts['debug_erb']
    puts source
    exit
  end

  root, warnings = Parser.parse(source, opts)
  $stderr.puts warnings if warnings
  output, c_warnings = Converter.convert(root, opts)
  $stderr.puts c_warnings if c_warnings
  output
end