lib/caramelize/page.rb in caramelize-0.3.0 vs lib/caramelize/page.rb in caramelize-0.4.0
- old
+ new
@@ -1,20 +1,21 @@
module Caramelize
class Page
- attr_accessor :title, :body, :id, :markup, :latest, :time, :message, :author, :author_name
+ attr_accessor :title, :body, :id, :markup, :latest, :time, :message,
+ :author, :author_name
- def initialize page={}
+ def initialize(page={})
@id = page[:id]
@title = page[:title] || ""
@body = page[:body] || ""
@syntax = page[:markup]
@latest = page[:latest] || false
@time = page[:time] || Time.now
@message = page[:message] || ""
@author = page[:author]
- @author_name = page[:author_name]
+ @author_name = page[:author_name]
end
def author_email
author.email
end
@@ -37,7 +38,12 @@
end
def to_s
@title
end
+
+ def commit_message
+ return "Edit in page #{title}" if message.empty?
+ message
+ end
end
-end
\ No newline at end of file
+end