lib/makit/mp/string_mp.rb in makit-0.0.2 vs lib/makit/mp/string_mp.rb in makit-0.0.3
- old
+ new
@@ -72,9 +72,15 @@
end
# Alias for set_json_value
alias_method :assign, :set_json_value
+ def strip_color_codes
+ # Regular expression to remove ANSI color codes
+ cleaned_content = self.gsub(/\e\[[\d;]+m/, "")
+ cleaned_content
+ end
+
def to_lines(max_length = 80, indent_length = 5)
if (self.length <= max_length)
return self
else
indent = " " * indent_length