lib/head_music/sign.rb in head_music-0.20.0 vs lib/head_music/sign.rb in head_music-0.22.0

- old
+ new

@@ -15,11 +15,11 @@ new(identifier: :double_flat, ascii: 'bb', unicode: '𝄫', html_entity: '𝄫', cents: -200), ] end def self.symbols - @sign_symbols ||= all.map { |sign| [sign.ascii, sign.unicode] }.flatten.reject { |s| s.nil? || s.empty? } + @symbols ||= all.map { |sign| [sign.ascii, sign.unicode] }.flatten.reject { |s| s.nil? || s.empty? } end def self.matcher @matcher ||= Regexp.new symbols.join('|') end @@ -28,9 +28,10 @@ candidate =~ /^(#{matcher})$/ end def self.get(identifier) return identifier if identifier.is_a?(HeadMusic::Sign) + all.detect do |sign| sign.representions.include?(identifier) end end