Module: CommandKit::FileUtils
Overview
File manipulation related methods.
Instance Method Summary collapse
-
#erb(source, dest = nil) ⇒ String?
Renders an erb file and optionally writes it out to a destination file.
Instance Method Details
#erb(source, dest = nil) ⇒ String?
Renders an erb file and optionally writes it out to a destination file.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/command_kit/file_utils.rb', line 36 def erb(source,dest=nil) erb = ERB.new(File.read(source), trim_mode: '-') result = erb.result(binding) if dest File.write(dest,result) return else return result end end |