I'm new to Ruby and don't know all the methods, so I was thinking there would probably be and easier way to do something like this. I'd love any input on how to refactor this.
define_singleton_method(:delete) do |id|
revised_words = []
@@words.each do |word|
if word.id() != id
revised_words.push(word)
else
Definition.delete_by_word_id(id)
end
end
@@words = revised_words
end
delete word from wordlist
\$\endgroup\$delete
method will be added? Is this part of a module that gets included in other classes? \$\endgroup\$