Class: BridgetownSitemap::GitInspector
- Inherits:
-
Object
- Object
- BridgetownSitemap::GitInspector
- Defined in:
- lib/bridgetown-sitemap/git_inspector.rb
Instance Method Summary collapse
-
#initialize(resource) ⇒ GitInspector
constructor
A new instance of GitInspector.
- #latest_git_commit_date ⇒ Object
Constructor Details
#initialize(resource) ⇒ GitInspector
Returns a new instance of GitInspector.
5 6 7 |
# File 'lib/bridgetown-sitemap/git_inspector.rb', line 5 def initialize(resource) @resource = resource end |
Instance Method Details
#latest_git_commit_date ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bridgetown-sitemap/git_inspector.rb', line 9 def latest_git_commit_date return nil unless git_repo? return nil unless repo_origin? date = cache.getset(@resource.id) do `git log -1 --pretty="format:%cI" "#{@resource.path}"` end Time.parse(date) if date.present? end |