lib/emoji_data.rb in emoji_data-0.0.1 vs lib/emoji_data.rb in emoji_data-0.0.2

- old
+ new

@@ -30,9 +30,14 @@ def self.find_by_unified(cp) EMOJI_CHARS.detect { |ec| ec.unified == cp.upcase } end + def self.find_by_str(str) + matches = EMOJI_CHARS.select { |ec| str.include? ec.char } + matches.sort_by { |matched_char| str.index(matched_char.char) } + end + def self.find_by_name(name) # self.all.select { |char| char.name.include? name.upcase } self.find_by_value(:name, name.upcase) end