R
Ruby Geo
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
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