lib/emojidex.rb in emojidex-0.1.0 vs lib/emojidex.rb in emojidex-0.2.0

- old
+ new

@@ -5,8 +5,16 @@ require_relative 'emojidex/data/categories' # Master emojidex module. Contains a few general helper functions. module Emojidex def self.escape_code(code) - code.tr(' ', '_') + code.tr(' ', '_').tr(':', '') + end + + def self.unescape_code(code) + code.tr('_', ' ') + end + + def self.encapsulate_code(code) + "#{Emojidex::Defaults.encapsulator}#{unescape_code(code)}#{Emojidex::Defaults.encapsulator}" end end