Class: CiscoWebex::Toolbox
- Inherits:
-
Object
- Object
- CiscoWebex::Toolbox
- Defined in:
- lib/Toolbox/Toolbox.rb
Defined Under Namespace
Classes: WebexTime
Class Method Summary collapse
Class Method Details
.search(list, params = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/Toolbox/Toolbox.rb', line 6 def self.search(list, params={}) list = [ list ] if list.class == Hash if !list || list.class != Array || params.length == 0 STDERR.puts "CicoWebex::Toolbox.search(list, params={}): Data provided for search much be am Array of Hashes, `params` must have parameters to search on" return false end results = [] for app in list matches = 0 for pair in params.each() if app[pair[0]] == pair[1] matches += 1 end end # if match count is the same as the length of params speficied then concider it a full match and add to results if matches == params.length() results.append(app) end end return results end |