lib/decant/content.rb in decant-0.2.0 vs lib/decant/content.rb in decant-0.3.0
- old
+ new
@@ -47,9 +47,23 @@
end
end
end
end
+ # The relative path of the file within its collection.
+ #
+ # @example
+ # Page = Decant.define(dir: 'content', ext: 'md')
+ #
+ # page = Page.find('features/slugs')
+ # page.path.expand_path # => "/Users/dave/my-website/content/features/slugs.md"
+ # page.relative_path # => "features/slugs.md"
+ #
+ # @return [String]
+ def relative_path
+ self.class.collection.relative_path_for(path)
+ end
+
# The extension-less relative path of the file within its collection.
#
# @example
# Page = Decant.define(dir: 'content', ext: 'md')
#