Class: EasterEggs::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/easter_eggs/search.rb

Class Method Summary collapse

Class Method Details

.perform(query) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/easter_eggs/search.rb', line 4

def perform(query)
  reference = references.find do |_universe, list|
    list.any? { |regex| regex =~ query.downcase }
  end&.first

  return if reference.nil?

  {
    reference: reference,
    message:   EasterEggs::Universe.t(reference)
  }
end