Sha256: f0275e741e55b6c19180539516855c18942ffdeb93ec8a39d4f2fe1f5980ecbb

Contents?: true

Size: 466 Bytes

Versions: 9

Compression:

Stored size: 466 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

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-3.7.4 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.7.3 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.7.2 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.7.1 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.7.0 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.6.11 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.6.10 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.6.9 lib/nanoc/extra/core_ext/pathname.rb
nanoc-3.6.8 lib/nanoc/extra/core_ext/pathname.rb