/usr/lib/ruby/vendor_ruby/twitter-text/unicode.rb is in ruby-twitter-text 1.10.0+gem-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | module Twitter
# This module lazily defines constants of the form Uxxxx for all Unicode
# codepoints from U0000 to U10FFFF. The value of each constant is the
# UTF-8 string for the codepoint.
# Examples:
# copyright = Unicode::U00A9
# euro = Unicode::U20AC
# infinity = Unicode::U221E
#
module Unicode
CODEPOINT_REGEX = /^U_?([0-9a-fA-F]{4,5}|10[0-9a-fA-F]{4})$/
def self.const_missing(name)
# Check that the constant name is of the right form: U0000 to U10FFFF
if name.to_s =~ CODEPOINT_REGEX
# Convert the codepoint to an immutable UTF-8 string,
# define a real constant for that value and return the value
#p name, name.class
const_set(name, [$1.to_i(16)].pack("U").freeze)
else # Raise an error for constants that are not Unicode.
raise NameError, "Uninitialized constant: Unicode::#{name}"
end
end
end
end
|