Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def self.open_file(search_word, *)
- search_word = search_word.downcase
- words = []
- File.readlines("data.json").select do |line|
- words << line if line.downcase.match?(search_word) || line.downcase.match?(reverse_string(search_word))
- end
- return decode(words) unless words.empty?
- ITEM_NOT_FOUND
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement