Sha256: 29c65f6b71c2f9818a026bde1927041e73c95f8dd85031fb5731f8c7064ddd0a
Contents?: true
Size: 675 Bytes
Versions: 37
Compression:
Stored size: 675 Bytes
Contents
require 'erb' class String def lines split $/ end def strip_whitespace_at_line_ends lines.map {|line| line.gsub(/\s+$/, '')} * $/ end end module Protodoc module Environment def include(*filenames) filenames.map {|filename| Preprocessor.new(filename).to_s}.join("\n") end end class Preprocessor include Environment def initialize(filename) @filename = File.expand_path(filename) @template = ERB.new(IO.read(@filename), nil, '%') end def to_s @template.result(binding).strip_whitespace_at_line_ends end end end if __FILE__ == $0 print Protodoc::Preprocessor.new(ARGV.first) end
Version data entries
37 entries across 24 versions & 1 rubygems