Permalink
Browse files

add a path helper to work with wiki-paths.

  • Loading branch information...
0robustus1 committed Jan 25, 2014
1 parent 4b73a03 commit cf88e4818f3149675a1e231c42c4f925d1efee56
Showing with 25 additions and 0 deletions.
  1. +24 −0 lib/path_helper.rb
  2. +1 −0 lib/soywiki.rb
View
@@ -0,0 +1,24 @@
+require 'pathname'
+
+module PathHelper
+
+ def repo_path=(repo_path)
+ @repo_path = repo_path
+ end
+
+ def repo_path
+ @repo_path
+ end
+
+ def repo_relative(path)
+ ensure_path(path).relative_path_from(repo_path)
+ end
+
+ def in_repo(path)
+ repo_path.join(path)
+ end
+
+ def ensure_path(path)
+ path.is_a?(Pathname) ? path : Pathname.new(path)
+ end
+end
View
@@ -1,4 +1,5 @@
require 'string_ext'
+require 'path_helper'
module Template_Substitution; end
module Soywiki
VERSION = '0.9.8'

0 comments on commit cf88e48

Please sign in to comment.