examples/installer: Add String#indent
@@ -6,4 +6,11 @@ class String
"AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz"
)
end
+
+ # Indent lines of a string, defaults to two spaces.
+ def indent(chars = " ")
+ self.split("\n").map do |line|
+ "#{chars}#{line}"
+ end.join("\n")
+ end
end
