From e7bb6f717b37c9598ca0e92baaa81f6845fa7dcf Mon Sep 17 00:00:00 2001 From: nov matake Date: Wed, 5 Oct 2011 11:19:19 +0900 Subject: [PATCH] date parsing change --- Gemfile.lock | 9 +++++---- lib/fb_graph/page/category_attributes.rb | 12 ++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 2a2f43d2..ad764f34 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - fb_graph (2.1.8) + fb_graph (2.1.9) httpclient (>= 2.2.0.2) rack-oauth2 (>= 0.9.4) @@ -41,8 +41,9 @@ GEM jruby-openssl (0.7.4) bouncy-castle-java json (1.6.1) + json (1.6.1-java) multi_json (1.0.3) - rack (1.3.3) + rack (1.3.4) rack-cache (1.0.3) rack (>= 0.4) rack-mount (0.8.3) @@ -67,10 +68,10 @@ GEM rspec-expectations (2.6.0) diff-lcs (~> 1.1.2) rspec-mocks (2.6.0) - sprockets (2.0.0) + sprockets (2.0.2) hike (~> 1.2) rack (~> 1.0) - tilt (!= 1.3.0, ~> 1.1) + tilt (~> 1.1, != 1.3.0) tilt (1.3.3) webmock (1.7.6) addressable (> 2.2.5, ~> 2.2) diff --git a/lib/fb_graph/page/category_attributes.rb b/lib/fb_graph/page/category_attributes.rb index 28c8249e..4d20117b 100644 --- a/lib/fb_graph/page/category_attributes.rb +++ b/lib/fb_graph/page/category_attributes.rb @@ -78,14 +78,14 @@ def initialize_with_category_specific_attributes(identifier, attributes = {}) end end @@attributes[:date].each do |key| - if attributes[key] - value = if attributes[key] =~ /\d{2}\/\d{2}\/\d{4}/ - Date.strptime(attributes[key], '%m/%d/%Y') - else - Date.parse(attributes[key]) rescue attributes[key] + date = if attributes[key] + begin + Date.parse attributes[key] + rescue + attributes[key] end - self.send :"#{key}=", value end + self.send :"#{key}=", date end @checkin_count = attributes[:checkins] @hours = {}