Module: Nanoc::Extra::PathnameExtensions

Included in:
Pathname
Defined in:
lib/nanoc/extra/core_ext/pathname.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) components



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/nanoc/extra/core_ext/pathname.rb', line 7

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

- (Boolean) include_component?(component)

Returns:

  • (Boolean)


19
20
21
# File 'lib/nanoc/extra/core_ext/pathname.rb', line 19

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