Partial Search

Can someone please help me to adjust the folowing method into
displaying
using a flag. Basically what I want it to do it have an array of
keywords
and a flag which asks partial match or exact

These are the keywords.

KEYWORDS =[“Sole Trader”, “Retail”, “Builder”, “Internet” ]

And this is the current method.

def self.search_by_keyword(businesses, searched_keyword)
businesses.select do |b|
b.my_keywords.include?(searched_keyword)
end
end

It has to me something like this.

  def self.search_by_keyword(businesses, searched_keyword_as_array,

flag_exact_or_partial_match)
businesses.select do |b|
b.my_keywords.include?(searched_keyword)
end
en

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs