Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Dekker's requests.

  • Loading branch information...
commit 74618325197a34cfcbabb36f95ff75a9bbae094f 1 parent effbf65
Ricky Robinson authored January 22, 2012

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. 6  lib/yelp.rb
6  lib/yelp.rb
@@ -69,8 +69,10 @@ def extract_categories items, parent = nil
69 69
         if item.name == "li"
70 70
           key = item.content.match(/\((.*)\)/)[1]
71 71
           name = item.content.match(/^(.*) \(/)[1]
72  
-          cats << {:key => key, :name => name, :parent => parent}
73  
-          prev = key
  72
+          short_name = name.split[0]
  73
+          prev = {:key => key, :name => name, :shortName => short_name, :parent => parent[:key], :numChildren => 0, :icon => "https://foursquare.com/img/categories/arts_entertainment/arcade_32.png"}
  74
+          cats << prev
  75
+          parent[:numChildren] += 1
74 76
         elsif item.name == "ul"
75 77
           subcats = self.extract_categories item.children, prev
76 78
           cats += subcats

0 notes on commit 7461832

Please sign in to comment.
Something went wrong with that request. Please try again.