carllerche (owner)

Revisions

gist: 220304 Download_button fork
public
Public Clone URL: git://gist.github.com/220304.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def matching(prop)
  @matching ||= inject({}) do |hash, p|
    (hash[p.root] ||= []) << p
    hash
  end[prop.root] || []
end
 
def matching(prop)
  @matching ||= begin
    map = {}
    each do |p|
      map[p.root] ||= []
      map[p.root] << p
    end
    map
  end
  @matching[prop.root] || []
end