Advertisement
Guest User

Untitled

a guest
Nov 7th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.33 KB | None | 0 0
  1.   def self.open_file(search_word, *)
  2.     search_word = search_word.downcase
  3.     words = []
  4.     File.readlines("data.json").select do |line|
  5.       words << line if line.downcase.match?(search_word) || line.downcase.match?(reverse_string(search_word))
  6.     end
  7.     return decode(words) unless words.empty?
  8.     ITEM_NOT_FOUND
  9.   end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement