Class: CiscoWebex::Toolbox

Inherits:
Object
  • Object
show all
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
# File 'lib/Toolbox/Toolbox.rb', line 6

def self.search(list, params={})
    if !list || list.class != Array || list.class != Hash || params == {}
        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 matches == params.length()
            results.append(app)
        end
    end
    return results
end