lib/tanuki_emoji/character.rb in tanuki_emoji-0.2.2 vs lib/tanuki_emoji/character.rb in tanuki_emoji-0.3.0
- old
+ new
@@ -80,17 +80,26 @@
def inspect
"#<#{self.class.name}:#{name} #{codepoints}(#{hex})>"
end
+ def ==(other)
+ name == other.name &&
+ codepoints == other.codepoints &&
+ codepoints_alternates == other.codepoints_alternates &&
+ alpha_code == other.alpha_code &&
+ aliases == other.aliases &&
+ description == other.description
+ end
+
# Convert Unicode code points to Hex format for inspection
#
# ensure alpha code is formatted with colons
#
# @param [String] alpha_code
# @return [String] formatted alpha code
def self.format_alpha_code(alpha_code)
- alpha_code.match?(/:([a-z_0-9]+):/) ? alpha_code : ":#{alpha_code}:"
+ alpha_code.to_s.match?(/:([_+\-a-z0-9]+):/) ? alpha_code.to_s : ":#{alpha_code}:"
end
private
# Return each codepoint converted to its hex value as string