Class: String

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

Overview

Extend String For Our Evil Purposes

Instance Method Summary collapse

Instance Method Details

#errObject



79
80
81
82
# File 'lib/globals.rb', line 79

def err
  c = " ERROR   ".red + self
  if $isWindows then c.bold else c end
end

#indentObject



92
93
94
# File 'lib/globals.rb', line 92

def indent
  "         " + self
end

#numeric?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/globals.rb', line 44

def numeric?
  Float(self) != nil rescue false
end

#successObject



88
89
90
# File 'lib/globals.rb', line 88

def success
  " SUCCESS ".green + self
end

#validate?(regex) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/globals.rb', line 48

def validate? regex
  !self[regex].nil?
end

#warnObject



84
85
86
# File 'lib/globals.rb', line 84

def warn
  " WARNING ".yellow + self
end