Class: VanillaText

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

Class Method Summary collapse

Class Method Details

.applyObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bro/string_hacks.rb', line 11

def apply
  String.class_eval do
    def colored
      FakeColor.new self
    end
      
    def unindent 
      gsub(/^#{scan(/^\s*/).min_by{|l|l.length}}/, "")
    end
  end

  %w{ status success problem sorry important underline }.each do |m|
    String.class_eval do
      define_method(m){ self }
    end
  end
end