Class: ColoredText

Inherits:
Object
  • Object
show all
Defined in:
lib/bro/string_hacks.rb

Class Method Summary collapse

Class Method Details

.applyObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/bro/string_hacks.rb', line 33

def apply
  String.class_eval do
    require 'smart_colored'

    def unindent 
      gsub(/^#{scan(/^\s*/).min_by{|l|l.length}}/, "")
    end

    def status
      self.colored.yellow
    end

    def success
      self.colored.green.bold
    end

    def problem
      self.colored.yellow_on_red_bold
    end

    def sorry
      self.colored.red.bold
    end

    def important
      self.colored.magenta
    end
  end
end