Sha256: 81fa29eb0bb1fe928423fb4936eba6b0e89bcfde4a4a1d08e657be6053ce90d6

Contents?: true

Size: 550 Bytes

Versions: 37

Compression:

Stored size: 550 Bytes

Contents

module Nanoc::Helpers
  # @see http://nanoc.ws/doc/reference/helpers/#childparent
  module ChildParent
    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

    def children_of(item)
      if item.identifier.legacy?
        item.children
      else
        pattern = item.identifier.without_ext + '/*'
        @items.find_all(pattern)
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
nanoc-4.4.7 lib/nanoc/helpers/child_parent.rb
nanoc-4.4.6 lib/nanoc/helpers/child_parent.rb
nanoc-4.4.5 lib/nanoc/helpers/child_parent.rb
nanoc-4.4.4 lib/nanoc/helpers/child_parent.rb
nanoc-4.4.3 lib/nanoc/helpers/child_parent.rb
nanoc-4.4.2 lib/nanoc/helpers/child_parent.rb
nanoc-4.4.1 lib/nanoc/helpers/child_parent.rb
nanoc-4.4.0 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.8 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.7 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.6 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.5 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.4 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.3 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.2 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.1 lib/nanoc/helpers/child_parent.rb
nanoc-4.3.0 lib/nanoc/helpers/child_parent.rb