Sha256: 820cb3f1e690da68145ee82ce8242a4a4ddf6c126951627ebe0432de1e17e533
Contents?: true
Size: 680 Bytes
Versions: 1
Compression:
Stored size: 680 Bytes
Contents
module Utils # Utility methods for manipulating text module Text # Try to make names more friendly def friendly_name(long_name) long_name.split(/\s/).first end # 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 # camel case puppet classes def class_camel(text) text.split('::').map(&:capitalize).join('::') 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lita-puppet-0.6.1 | lib/utils/text.rb |