Class: Aardi::Folder

Inherits:
Object
  • Object
show all
Defined in:
lib/aardi/folder.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Folder

Returns a new instance of Folder.



5
6
7
8
# File 'lib/aardi/folder.rb', line 5

def initialize(path)
  @path = path
  @normalized_path = "#{path.sub(/^\./, '')}/"
end

Instance Method Details

#mtimeObject



10
# File 'lib/aardi/folder.rb', line 10

def mtime = children.filter_map(&:mtime).max

#renderObject



12
13
14
15
16
# File 'lib/aardi/folder.rb', line 12

def render
  result = children.each_with_object({}) { |child, acc| acc.merge!(child.render) }
  Aardi.renderer.sitemap.record_mtime(@normalized_path, mtime) unless @path == '.'
  result
end