Module: Spongebobify

Defined in:
lib/spongebobify.rb,
lib/spongebobify/cli.rb,
lib/spongebobify/version.rb

Defined Under Namespace

Classes: CLI

Constant Summary collapse

VERSION =
'0.1.3'

Class Method Summary collapse

Class Method Details

.process(input_string) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/spongebobify.rb', line 15

def self.process(input_string)
  index = 0
  byte_array = []

  input_string.each_byte do |byte|
    if index % 2 == 0
      byte_array << (is_uppercase(byte) ? (byte ^ 32) : byte)
    else
      byte_array << (is_lowercase(byte) ? (byte ^ 32) : byte)
    end
    index += 1
  end

  byte_array.pack('C*')
end