/
search_helper.rb
44 lines (41 loc) · 1020 Bytes
/
search_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# TODO: missing license header.
# possibly dead code. to revive, move SearchHelper to the Merb namespace.
# module Merb
# module ChefServerWebui
# module SearchHelper
# def output_path(attributes)
# res = Hash.new
# attributes.each do |path|
# parts = path.split("/")
# unless parts[0].nil?
# parts.shift if parts[0].length == 0
# end
# res[path] = ohai_walk(parts)
# end
# res
# end
#
# def ohai_walk(path)
# unless path[0]
# @@ohai.to_json
# else
# ohai_walk_r(@@ohai, path)
# end
# end
#
# def ohai_walk_r(ohai, path)
# hop = (ohai.is_a?(Array) ? path.shift.to_i : path.shift)
# if ohai[hop]
# if path[0]
# ohai_walk_r(ohai[hop], path)
# else
# ohai[hop].to_json
# end
# else
# nil
# end
# end
# end
# end
# end # Merb
#