Module: Zalgo
- Defined in:
- lib/zalgo.rb
Defined Under Namespace
Modules: Characters
Class Method Summary collapse
Class Method Details
permalink .he_comes(text, options = {}) ⇒ Object
[View source]
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/zalgo.rb', line 57 def self.he_comes(text, = {}) result = '' = { :up => true, :mid => true, :down => true }.merge text.each_char.each do |char| next if Characters.is_char? char result << char counts = { :up => 0, :mid => 0, :down => 0 } case [:size] when :mini counts[:up] = rand(8) counts[:mid] = rand(2) counts[:down] = rand(8) when :maxi counts[:up] = rand(16) + 3 counts[:mid] = rand(4) + 1 counts[:down] = rand(64) + 3 else counts[:up] = rand(8) + 1 counts[:mid] = rand(6) / 2 counts[:down] = rand(8) + 1 end [:up, :mid, :down].each do |d| counts[d].times { result << Characters.send(d)[rand Characters.send(d).size] } if [d] end end result end |