Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/phoseum/phoseum-cli-lib.rb,
lib/phoseum/phoseum-common-lib.rb
Instance Method Summary collapse
- #blue ⇒ Object
-
#colorize(color_code) ⇒ Object
colorization.
- #green ⇒ Object
- #light_blue ⇒ Object
- #pink ⇒ Object
- #red ⇒ Object
- #remove_non_ascii(replacement = '') ⇒ Object
- #test_password ⇒ Object
- #yellow ⇒ Object
Instance Method Details
#blue ⇒ Object
137 138 139 |
# File 'lib/phoseum/phoseum-cli-lib.rb', line 137 def blue colorize(34) end |
#colorize(color_code) ⇒ Object
colorization
121 122 123 |
# File 'lib/phoseum/phoseum-cli-lib.rb', line 121 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end |
#green ⇒ Object
129 130 131 |
# File 'lib/phoseum/phoseum-cli-lib.rb', line 129 def green colorize(32) end |
#light_blue ⇒ Object
145 146 147 |
# File 'lib/phoseum/phoseum-cli-lib.rb', line 145 def light_blue colorize(36) end |
#pink ⇒ Object
141 142 143 |
# File 'lib/phoseum/phoseum-cli-lib.rb', line 141 def pink colorize(35) end |
#red ⇒ Object
125 126 127 |
# File 'lib/phoseum/phoseum-cli-lib.rb', line 125 def red colorize(31) end |
#remove_non_ascii(replacement = '') ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# 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 ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# 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 ⇒ Object
133 134 135 |
# File 'lib/phoseum/phoseum-cli-lib.rb', line 133 def yellow colorize(33) end |