diff options
author | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-15 16:37:22 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.corp.reactrix.com> | 2007-11-15 16:37:22 -0800 |
commit | de33ae22c4ee389afc4a9e15b3edab17d4528321 (patch) | |
tree | 6850d7877f4d892e0ae25e5b1c8fc636a6ac6b9e /lib/git | |
parent | a6e6c0552708166ea052a99bdd9420dcc33536e0 (diff) | |
download | third_party-ruby-git-de33ae22c4ee389afc4a9e15b3edab17d4528321.tar.gz third_party-ruby-git-de33ae22c4ee389afc4a9e15b3edab17d4528321.tar.xz third_party-ruby-git-de33ae22c4ee389afc4a9e15b3edab17d4528321.zip |
added object content caching
Diffstat (limited to 'lib/git')
-rw-r--r-- | lib/git/object.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/git/object.rb b/lib/git/object.rb index 33c3e38..afda923 100644 --- a/lib/git/object.rb +++ b/lib/git/object.rb @@ -10,7 +10,8 @@ module Git attr_accessor :sha, :size, :type, :mode @base = nil - + @contents = nil + def initialize(base, sha) @base = base @sha = sha.to_s @@ -18,8 +19,9 @@ module Git setup end + # caches the contents of this call in memory def contents - @base.lib.object_contents(@sha) + @contents || @contents = @base.lib.object_contents(@sha) end def contents_array |