Sha256: 3f510cc15d4b35bbcf4788d9cb860f23037a6e08453586733db4c4c561c75b4b

Contents?: true

Size: 462 Bytes

Versions: 2

Compression:

Stored size: 462 Bytes

Contents

# encoding: utf-8

module Nanoc::Extra
  module PathnameExtensions
    def components
      components = []
      tmp = self
      loop do
        old = tmp
        components << File.basename(tmp)
        tmp = File.dirname(tmp)
        break if old == tmp
      end
      components.reverse
    end

    def include_component?(component)
      components.include?(component)
    end
  end
end

class ::Pathname
  include ::Nanoc::Extra::PathnameExtensions
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nanoc-3.8.0 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.7.5 lib/nanoc/extra/core_ext/pathname.rb