Sha256: 3a16478f901160ea8ca847b54a100dc4f2de95c5ac9e77154521d032814c3e82
Contents?: true
Size: 719 Bytes
Versions: 3
Compression:
Stored size: 719 Bytes
Contents
require 'fileutils' module Xdrgen class Output attr_reader :source_paths attr_reader :output_dir def initialize(source_paths, output_dir) @source_paths = source_paths @output_dir = output_dir @files = {} end 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 def write(child_path, content) open(child_path){|c| c.puts content} end def close @files.values.each(&:close) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
xdrgen-0.1.1 | lib/xdrgen/output.rb |
xdrgen-0.1.0 | lib/xdrgen/output.rb |
xdrgen-0.0.1 | lib/xdrgen/output.rb |