Skip to content

Commit

Permalink
Don't break on unknown words
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysonvirissimo committed Apr 28, 2024
1 parent 5a63486 commit 4661214
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/medieval_latina.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def self.pronunciations_for(words)
words.map(&:downcase).each_with_object({}) do |word, hash|
metadata = DICTIONARY[word]

if metadata["ipa"]
if metadata && metadata["ipa"]
hash[word] = metadata["ipa"]
end
end
Expand Down
4 changes: 4 additions & 0 deletions spec/medieval_latina_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@
"vir" => "vir"
)
end

it "doesn't break on words that aren't in the dictionary" do
expect { described_class.pronunciations_for(["foo"]) }.not_to raise_error
end
end

describe ".verbs" do
Expand Down

0 comments on commit 4661214

Please sign in to comment.