Module: Pathname::Extensions::Explode

Defined in:
lib/pathname/extensions/explode.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(host) ⇒ Object



8
9
10
11
# File 'lib/pathname/extensions/explode.rb', line 8

def self.included(host)
  super
  host.load_extensions :constants
end

Instance Method Details

#explodeArray<Pathname>

Explode a path into individual components

Returns:

See Also:



18
19
20
21
22
23
24
# File 'lib/pathname/extensions/explode.rb', line 18

def explode
  head, tail = split
  return [self] if head == self
  return [tail] if head == HERE || tail == ROOT
  return [head, tail] if head == ROOT
  head.explode + [tail]
end