module Nanoc::Helpers::ChildParent

@see nanoc.app/doc/reference/helpers/#childparent

Public Instance Methods

children_of(item) click to toggle source
# File lib/nanoc/helpers/child_parent.rb, line 15
def children_of(item)
  if item.identifier.legacy?
    item.children
  else
    pattern = item.identifier.without_ext + '/*'
    @items.find_all(pattern)
  end
end
parent_of(item) click to toggle source
# File lib/nanoc/helpers/child_parent.rb, line 6
def parent_of(item)
  if item.identifier.legacy?
    item.parent
  else
    path_without_last_component = item.identifier.to_s.sub(/[^\/]+$/, '').chop
    @items[path_without_last_component + '.*']
  end
end