Sha256: 7d2ab770384e8928a0353cc92f16cb569586e9e02970b9d5fdfd0fdfc471541f
Contents?: true
Size: 748 Bytes
Versions: 1
Compression:
Stored size: 748 Bytes
Contents
# frozen_string_literal: true class String def to_hieroglyph hash = { A: ["1313F"], B: ["130C0"], C: ["133A1"], D: ["130A7"], E: ["131CB"], F: ["13191"], G: ["133BC"], H: ["1339B"], I: ["131CB"], J: ["13193"], K: ["133A1"], L: ["130ED"], M: ["13153"], N: ["13216"], O: ["1336F"], P: ["133E4"], Q: ["133D8"], R: ["1308B"], S: ["132F4"], T: ["133CF"], U: ["13171"], V: ["13191"], W: ["13171"], X: %w[133A1 132F4], Y: ["131CB"], Z: ["13283"] } result = [] strings = upcase.split("") strings.each do |string| hash[string.to_sym] ? result.push(hash[string.to_sym].map { |s| s.hex.chr(Encoding::UTF_8) }) : result.push(string) end hieroglyphics = result.join end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pharaoh_lang-0.1.1 | lib/format-hieroglyph.rb |