class Xdrgen::Output
Attributes
output_dir[R]
source_paths[R]
Public Class Methods
new(source_paths, output_dir)
click to toggle source
# File lib/xdrgen/output.rb, line 9 def initialize(source_paths, output_dir) @source_paths = source_paths @output_dir = output_dir @files = {} end
Public Instance Methods
close()
click to toggle source
# File lib/xdrgen/output.rb, line 32 def close @files.values.each(&:close) end
open(child_path) { |result| ... }
click to toggle source
# File lib/xdrgen/output.rb, line 15 def open(child_path) if @files.has_key?(child_path) raise Xdrgen::DuplicateFileError, "Cannot open #{child_path} twice" end path = File.join @output_dir, child_path result = @files[child_path] = OutputFile.new(path) yield result if block_given? result end
write(child_path, content)
click to toggle source
# File lib/xdrgen/output.rb, line 28 def write(child_path, content) open(child_path){|c| c.puts content} end