This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module CaseConverter | |
class Transformations | |
class << self | |
def transform(value) | |
case value | |
when Array then value.map { |item| transform(item) } | |
when Hash then value.deep_transform_keys! { |key| transform(key) } | |
when String then camelize(value) | |
else value | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Encodes/Decodes string in a string of binaries | |
-- | |
-- Each char is converted to a string with eight 0s or 1s | |
-- λ> encode "The darkside of the force is a pathway to many abilities some consider to be unnatural" | |
-- "0101010001101000011001010010000001100100011000010111001001101011011100110110100101100100011001010 | |
-- 01000000110111101100110001000000111010001101000011001010010000001100110011011110111001001100011011 | |
-- 00101001000000110100101110011001000000110000100100000011100000110000101110100011010000111011101100 |