lib/utils/text.rb in lita-puppet-0.5.5 vs lib/utils/text.rb in lita-puppet-0.6.0
- old
+ new
@@ -9,7 +9,14 @@
# Strip off bad characters
def sanitze_for_chat(text)
# Remove bash colorings
text.gsub(/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]/, '')
end
+
+ # Format some text as code
+ # Note that this is HipChat specific for the moment
+ # TODO: Make this *not* HipChat specific
+ def as_code(text)
+ "/code " + sanitze_for_chat(text)
+ end
end
end