make Page#data lazy

This commit is contained in:
Tom Preston-Werner
2010-04-08 16:41:44 -07:00
parent 0aa67bb508
commit 58779490b4
+9 -2
View File
@@ -2,7 +2,7 @@ module Gollum
class Page
VALID_PAGE_RE = /^(.+)\.(md|mkdn?|mdown|markdown|textile|rdoc|org|re?st(\.txt)?|asciidoc|pod|\d)$/i
attr_accessor :wiki, :data
attr_accessor :wiki, :blob
# Initialize a page.
#
@@ -19,10 +19,17 @@ module Gollum
#
# Returns the populated Gollum::Page.
def populate(blob)
self.data = blob.data
self.blob = blob
self
end
# The contents of the page.
#
# Returns the String data.
def data
self.blob.data
end
# Find a page in the given Gollum repo.
#
# name - The human or canonical String page name to find.