String#each_codepoint
と Fixnum#to_s
に基数 16 を渡す。
$ ruby -v ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
$ irb irb(main):001:0> "ほげ".each_codepoint.to_a => [12411, 12370] irb(main):002:0> "ほげ".each_codepoint.map{|n| n.to_s(16) } => ["307b", "3052"] irb(main):003:0> ["\u307b", "\u3052"] => ["ほ", "げ"]