Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Search Array
Ruby Geo
12/13/2007 3:16:00 PM
Hi all.
I am trying to convert the folowing code into a class method. which
takes two argument. ! for keywords and another for business(callection
of classes). which both are arrays. And I am stack any help ? ?
objects = [bsn0, bsn1, bsn2, bsn3, bsn4]
search = ["Sole Trader"]
results = objects.select do |b|
match = true
catch(:success) do
search.each{|s| throw :success if b.my_keywords.include?(s) }
match = false
end
match
end
puts (" ")
puts "Search Results"
puts (" ")
results.each{|r| puts r }
'''''''''''''''''''''''''''''''''''''''''''''''''''
Attemted method
def self.search_type(key ,user)
objects = [bsn0, bsn1, bsn2, bsn3, bsn4]
#search = ["Sole Trader"]
#search = [KEYWORDS[0],KEYWORDS[1],KEYWORDS[2],KEYWORDS[3]]
results = objects.select do |b|
b.my_keywords.include?(search[0])
end
end
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Search Array
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password