Skip to content

Commit

Permalink
added inspect method to mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp Brüll committed Feb 28, 2011
1 parent f52b77f commit 3039484
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/gom/object/mapping.rb
Expand Up @@ -35,6 +35,12 @@ def clear!
@map.clear
end

def inspect
output = ""
@map.each{ |object, id| output += object.inspect + " => " + id.to_s + "\n" }
output
end

def self.singleton
@mapping ||= self.new
end
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/gom/object/mapping_spec.rb
Expand Up @@ -89,6 +89,15 @@

end

describe "inspect" do

it "should return a string with all the mappings" do
output = @mapping.inspect
output.should =~ /#<Object:.*> => test_storage:object_1\n/
end

end

end

describe "class method" do
Expand Down

0 comments on commit 3039484

Please sign in to comment.