From 8f7e2c0da2967a5c2442d130d2f68d79202171de Mon Sep 17 00:00:00 2001 From: Jakub Stastny aka botanicus Date: Thu, 3 Mar 2011 14:54:42 +0000 Subject: [PATCH] Added Ace::Item#server_path and Ace::Item#permalink. --- lib/ace.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/ace.rb b/lib/ace.rb index ac30b9d..857abc4 100644 --- a/lib/ace.rb +++ b/lib/ace.rb @@ -115,6 +115,23 @@ module Ace end end + def server_path + absolute = self.output_path.sub(/^output\//, "") + "/#{absolute}" + end + + def base_url + self.config[:base_url] + end + + def permalink + if self.config[:base_url].nil? + raise "You have to add :base_url into config.yml or redefine #base_url method!" + end + + "#{self.base_url}/#{self.server_path}" + end + attr_writer :output_path def output_path @output_path ||= begin