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



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

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)


17
18
19
# File 'lib/nanoc/extra/core_ext/pathname.rb', line 17

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