diff --git a/lib/utilities/string_cleaner.rb b/lib/utilities/string_cleaner.rb index 23ca5ee..ff1679e 100644 --- a/lib/utilities/string_cleaner.rb +++ b/lib/utilities/string_cleaner.rb @@ -26,14 +26,14 @@ def self.prefixes def self.strip_symbols(str) # str.gsub(/[\p{P}\p{Sm}\p{Sc}\p{So}^`]/, "") - str.gsub(/["'(){}\[\]]/, "") + str.gsub(/["']/, "") end # TODO: add bits to remove field prefix (e.g., 'author:') as defined in 00-catalog.yml # this is where the author browse specific cleaning goes def self.cleanup_author_browse_string(str) prefixes.each do |x| - if str.match?(/^#{x}:["(]/) + if str.match?(/^#{x}:/) str.sub!(/^#{x}:/, "") break end diff --git a/spec/utilities/string_cleaner_spec.rb b/spec/utilities/string_cleaner_spec.rb index 4b510b7..e4a240f 100644 --- a/spec/utilities/string_cleaner_spec.rb +++ b/spec/utilities/string_cleaner_spec.rb @@ -1,7 +1,7 @@ describe StringCleaner do context ".strip_symbols" do it "removes certain punctuation" do - expect(described_class.strip_symbols('"\'(){}[]')).to eq("") + expect(described_class.strip_symbols('"\'')).to eq("") end end context ".cleanup_author_browse_string" do @@ -9,7 +9,7 @@ expect(described_class.cleanup_author_browse_string('author:"Author Name"')).to eq("Author Name") end it "removes 'isn(' prefix" do - expect(described_class.cleanup_author_browse_string('isn:("123-456")')).to eq("123-456") + expect(described_class.cleanup_author_browse_string("isn:(123-456)")).to eq("(123-456)") end end end