Skip to content

Instantly share code, notes, and snippets.

@jcortesg
Created June 23, 2021 18:31
Show Gist options
  • Save jcortesg/d2168aea6b3ee849697e1ab2b7ad0e86 to your computer and use it in GitHub Desktop.
Save jcortesg/d2168aea6b3ee849697e1ab2b7ad0e86 to your computer and use it in GitHub Desktop.
class Word
def initialize(word, meaning)
@word = word
@meaning = meaning
end
def word
@word
end
def meaning
@meaning
end
end
class Dictionary
def initialize(array = [])
@array = array
end
def find_meaning(word)
res = @array.find { |e| e.word == word }
res.meaning
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment