Sha256: 7ade709f836203c6d19d36c4dd9c150de2452441d739436de52604a92b601229
Contents?: true
Size: 930 Bytes
Versions: 2
Compression:
Stored size: 930 Bytes
Contents
module RbPlusPlus module Writers # Writer that takes a builder and writes out the code in # one single file class SingleFileWriter < Base def write process_code(builder) filename = builder.name cpp_file = File.join(working_dir, "#{filename}.rb.cpp") File.open(cpp_file, "w+") do |cpp| cpp.puts builder.to_s end end protected # What we do here is to go through the builder heirarchy # and push all the code from children up to the parent, # ending up with all the code in the top-level builder def process_code(builder) builder.builders.each do |b| process_code(b) end return unless builder.parent builder.parent.includes << builder.includes builder.parent.body << builder.body builder.parent.declarations << builder.declarations end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rbplusplus-0.1.1 | lib/rbplusplus/writers/single_file_writer.rb |
rbplusplus-0.1 | lib/rbplusplus/writers/single_file_writer.rb |