Class: Xdrgen::Compilation

Inherits:
Object
  • Object
show all
Extended by:
Memoist
Defined in:
lib/xdrgen/compilation.rb

Instance Method Summary collapse

Constructor Details

#initialize(source_paths, output_dir: ".", language: :ruby, namespace: nil) ⇒ Compilation

Returns a new instance of Compilation.



5
6
7
8
9
10
# File 'lib/xdrgen/compilation.rb', line 5

def initialize(source_paths, output_dir:".", language: :ruby, namespace: nil)
  @source_paths = source_paths
  @output_dir  = output_dir
  @namespace   = namespace
  @language    = language
end

Instance Method Details

#compileObject



21
22
23
24
25
26
27
28
29
# File 'lib/xdrgen/compilation.rb', line 21

def compile
  output = Output.new(@source_paths, @output_dir)

  
  generator = Generators.for_language(@language).new(ast, output, @namespace)
  generator.generate
ensure
  output.close
end