lib/tap/templater.rb in tap-0.18.0 vs lib/tap/templater.rb in tap-0.19.0

- old
+ new

@@ -114,16 +114,27 @@ ["module #{name}", "end"] end nest(nesting, indent, line_sep) { yield } end + + def indent(indent, str) + lines = str.kind_of?(Array) ? str : str.split("\n") + lines.collect! {|line| "#{indent}#{line}" } + lines.join("\n") + end end class << self # Builds the erb template with the specified attributes. def build(template, attributes={}, filename=nil) - new(template, attributes, filename).build + new(template).build(attributes, filename) + end + + # Builds the erb template file with the specified attributes. + def build_file(path, attributes={}) + self.build(File.read(path), attributes, path) end end include Utils \ No newline at end of file