Sha256: 7b1f74e681ac5133fff746e635d8cc48620d2f1752c1fcf40d040c8b2ecbd6f5
Contents?: true
Size: 981 Bytes
Versions: 7
Compression:
Stored size: 981 Bytes
Contents
require_relative 'safe/format' class String alias :old_method_missing :method_missing alias :old_respond_to? :respond_to? def method_missing(method, *args) name = method.to_s colors = 'black|red|green|yellow|blue|purple|cyan|white|none' if (name =~ /format(_bold)?(_underline)?(?:_fg_(#{colors}))?(?:_bg_(#{colors}))?/).nil? old_method_missing(method, *args) else EverydayCliUtils::Format::format(self, EverydayCliUtils::Format::build_string(!$1.nil?, !$2.nil?, $3.nil? ? nil : $3.to_sym, $4.nil? ? nil : $4.to_sym)) end end def respond_to?(method) name = method.to_s colors = 'black|red|green|yellow|blue|purple|cyan|white|none' (!(name =~ /format(_bold)?(_underline)?(?:_fg_(#{colors}))?(?:_bg_(#{colors}))?/).nil?) || old_respond_to?(method) end def format_all EverydayCliUtils::Format::format_all(self) end def mycenter(len, char = ' ') EverydayCliUtils::Format::mycenter(self, len, char) end end
Version data entries
7 entries across 7 versions & 1 rubygems