class String

Public Instance Methods

blue() click to toggle source
# File lib/phoseum/phoseum-cli-lib.rb, line 137
def blue
  colorize(34)
end
colorize(color_code) click to toggle source

colorization

# File lib/phoseum/phoseum-cli-lib.rb, line 121
def colorize(color_code)
  "\e[#{color_code}m#{self}\e[0m"
end
green() click to toggle source
# File lib/phoseum/phoseum-cli-lib.rb, line 129
def green
  colorize(32)
end
light_blue() click to toggle source
# File lib/phoseum/phoseum-cli-lib.rb, line 145
def light_blue
  colorize(36)
end
pink() click to toggle source
# File lib/phoseum/phoseum-cli-lib.rb, line 141
def pink
  colorize(35)
end
red() click to toggle source
# File lib/phoseum/phoseum-cli-lib.rb, line 125
def red
  colorize(31)
end
remove_non_ascii(replacement='') click to toggle source
# File lib/phoseum/phoseum-common-lib.rb, line 5
def remove_non_ascii(replacement='')
  n=self.split("")
  self.slice!(0..self.size)
  n.each { |b|
   if b.ord < 48 || b.ord > 57 && b.ord < 65 || b.ord > 90 && b.ord < 97 || b.ord > 122 then
     self.concat(replacement)
   else
     self.concat(b)
   end
  }
  self.to_s
end
test_password() click to toggle source
# File lib/phoseum/phoseum-common-lib.rb, line 18
def test_password()
  symbol = false
  number = false
  capital= false
  regular= false
  all_valid= true
  n=self.split("")
  self.slice!(0..self.size)
  n.each { |b|
   # test symbols
   if b.ord > 32 && b.ord < 48 || b.ord > 58 && b.ord < 65 || b.ord > 91 && b.ord < 97 || b.ord > 123 && b.ord < 126 then
     symbol = true
   # test capital letters
   elsif b.ord > 65 && b.ord < 91 then
     capital = true
   # test numbers
   elsif b.ord > 47 && b.ord < 58 then
     number = true
   # test regular alphabet
   elsif b.ord > 96 && b.ord < 123 then
     regular = true
   else
     # com character out of the acceptable ranges
     all_valid = false
   end
  }
  if symbol && capital && number && regular && all_valid
    return true
  end
end
yellow() click to toggle source
# File lib/phoseum/phoseum-cli-lib.rb, line 133
def yellow
  colorize(33)
end