Method use?

I have this class method which takes 2 parameter and how can I use it to
print the
input.

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


e.g

Array outside the class
KEYWORDS =[“Sole Trader”, “Retail”, “Builder”, “Internet” ]

objects and asocieted keywords

bsn1 = Business.new(“Steve”, “02089293323”, "22 lilly Road "
bsn1.add_keyword(KEYWORDS[0])
bsn1.add_keyword(KEYWORDS[2])
bsn1.add_keyword(KEYWORDS[3])
puts bsn1.to_s


using the above method I want to display the business that contain a
keyword.

Thank YOu

I have this class method which takes 2 parameter and how can I use it to
print the input.

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


e.g

Array outside the class
KEYWORDS =[“Sole Trader”, “Retail”, “Builder”, “Internet” ]

objects and asocieted keywords

bsn1 = Business.new(“Steve”, “02089293323”, "22 lilly Road "
bsn1.add_keyword(KEYWORDS[0])
bsn1.add_keyword(KEYWORDS[2])
bsn1.add_keyword(KEYWORDS[3])
puts bsn1.to_s

bsn4 = Business.new(“Laura”, “02078982323”, "100 Abbey Road ")
bsn4.add_keyword(KEYWORDS[0])
bsn4.add_keyword(KEYWORDS[2])
puts bsn4.to_s


using the above method I want to display the business that contain a
keyword.

Thank YOu

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