Changeset 14

Show
Ignore:
Timestamp:
07/09/06 00:17:35 (3 years ago)
Author:
imperator
Message:

Finished the search method

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • www-raa/lib/www/raa.rb

    r13 r14  
    1212    end 
    1313 
    14     # Returns an array of Entry objects based on a search of the RAA.  These 
    15     # are the same results that would be returned if you had used the search 
    16     # feature on the RAA itself. 
    17     #-- 
    18     # TODO: finish 
     14    # Returns an array of RAA::Entry objects based on a search of the RAA. 
     15    # These are the same results that would be returned if you had used the 
     16    # search feature on the RAA web page itself. 
     17    # 
    1918    def search(project) 
     19      entries = [] 
    2020      mech = WWW::Mechanize.new 
    2121      mech.get(HOME_PAGE + "/search.rhtml?search=#{project}") 
     22      mech.page.links.each{ |link| 
     23         if link.href =~ /^project\/(.*?)\/$/ 
     24            entries.push(RAA::Entry.new($1)) 
     25         end 
     26      } 
     27      entries 
    2228    end 
    2329 
    2430    module_function :update_entry 
     31    module_function :search 
    2532       
    2633    # The Entry class represents a project entry on the RAA.