Skip to content
Browse files

Fix for false in pages

  • Loading branch information...
1 parent d743b89 commit 3d651b8f2811a387b70ab3a03b44c45fa683ad19 @mmangino mmangino committed Apr 14, 2011
Showing with 7 additions and 3 deletions.
  1. +2 −2 lib/mogli/client.rb
  2. +1 −1 mogli.gemspec
  3. +4 −0 spec/client_spec.rb
View
4 lib/mogli/client.rb
@@ -138,9 +138,9 @@ def map_data(data,klass=nil)
#protected
def extract_hash_or_array(hash_or_array,klass)
+ hash_or_array = hash_or_array.parsed_response if hash_or_array.respond_to?(:parsed_response)
return nil if hash_or_array == false
return hash_or_array if hash_or_array.nil? or hash_or_array.kind_of?(Array)
- hash_or_array = hash_or_array.parsed_response if hash_or_array.respond_to?(:parsed_response)
return extract_fetching_array(hash_or_array,klass) if is_fetching_array?(hash_or_array)
return hash_or_array
end
@@ -162,7 +162,7 @@ def extract_fetching_array(hash,klass)
end
def map_to_class(hash_or_array,klass)
- return nil if hash_or_array.nil?
+ return nil if !hash_or_array
if hash_or_array.kind_of?(Array)
hash_or_array.map! {|i| create_instance(klass,i)}
else
View
2 mogli.gemspec
@@ -1,6 +1,6 @@
spec = Gem::Specification.new do |s|
s.name = 'mogli'
- s.version = '0.0.27'
+ s.version = '0.0.28'
s.summary = "Open Graph Library for Ruby"
s.description = %{Simple library for accessing the facebook Open Graph API}
s.files = Dir['lib/**/*.rb']
View
4 spec/client_spec.rb
@@ -219,6 +219,10 @@
it "returns nil if we get a false response" do
client.map_data(false,Mogli::User).should be_false
end
+ it "returns false if we get a false response" do
+ client.map_to_class(false,Mogli::User).should be_false
+ end
+
it "returns the array if no class is specified and there is only a data parameter" do
client.map_data({"data"=>[user_data,user_data]}).should be_kind_of(Array)

0 comments on commit 3d651b8

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