Class: Sitepress::AssetPaths
- Inherits:
-
Object
- Object
- Sitepress::AssetPaths
- Includes:
- Enumerable
- Defined in:
- lib/sitepress/asset_paths.rb
Overview
Iterates through a folder, ignores partials and files that are well known to not be part of the website files, like ‘.DS_Store`, etc.
Constant Summary collapse
- IGNORE_PATTERNS =
Exclude swap files created by Textmate and vim from being added to the sitemap.
[ "**/*~", # Created by many editors when things crash "**/*.swp", # Created by vim "**/.DS_Store", # Created by our friends at Apple "**/*.orig", # Created when there's a git conflict "**/.git*" # This is a problem when a git repo is nested in a project's `./pages` folder. ]
- PARTIAL_PREFIX =
Template files that start with ‘_user.html.erb` are partials that we want to ignore for the site’s navigation tree.
"_".freeze
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#each ⇒ Object
Returns a list of files, paths, and node names to iterate through to build out nodes.
-
#initialize(path:) ⇒ AssetPaths
constructor
A new instance of AssetPaths.
Constructor Details
#initialize(path:) ⇒ AssetPaths
Returns a new instance of AssetPaths.
24 25 26 |
# File 'lib/sitepress/asset_paths.rb', line 24 def initialize(path:) @path = Pathname.new(path) end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
22 23 24 |
# File 'lib/sitepress/asset_paths.rb', line 22 def path @path end |
Instance Method Details
#each ⇒ Object
Returns a list of files, paths, and node names to iterate through to build out nodes
29 30 31 32 33 |
# File 'lib/sitepress/asset_paths.rb', line 29 def each path.each_child do |path| yield path unless ignore_file? path end end |