Permalink
Browse files

Dekker's requests.

  • Loading branch information...
1 parent effbf65 commit 74618325197a34cfcbabb36f95ff75a9bbae094f @rickyrobinson committed Jan 21, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/yelp.rb
View
@@ -69,8 +69,10 @@ def extract_categories items, parent = nil
if item.name == "li"
key = item.content.match(/\((.*)\)/)[1]
name = item.content.match(/^(.*) \(/)[1]
- cats << {:key => key, :name => name, :parent => parent}
- prev = key
+ short_name = name.split[0]
+ prev = {:key => key, :name => name, :shortName => short_name, :parent => parent[:key], :numChildren => 0, :icon => "https://foursquare.com/img/categories/arts_entertainment/arcade_32.png"}
+ cats << prev
+ parent[:numChildren] += 1
elsif item.name == "ul"
subcats = self.extract_categories item.children, prev
cats += subcats

0 comments on commit 7461832

Please sign in to comment.