Class PathList
In: lib/more/facets/pathlist.rb
Parent: Array

PathList

A PathList is an array containing 1..n paths. It is useful to regroup paths and make lookups on them.

Usage

 path = PathList.new(ENV['PATH'])
 path.find 'env'            #=> "/usr/bin/env"

 # This is already done when including the library
 $:.class                   #=> Array
 $:.extend PathList::Finder
 $:.find_ext = 'rb'

 $:.find 'uri'              #=> "/usr/lib/ruby/1.8/uri.rb"

Methods

new   to_s  

Included Modules

Finder

Classes and Modules

Module PathList::Finder

Public Class methods

[Source]

# File lib/more/facets/pathlist.rb, line 55
  def initialize(paths, default_ext = nil)
    @find_ext = default_ext
    if paths.kind_of? String
      paths = paths.split(File::PATH_SEPARATOR)
    end
    super(paths)
  end

Public Instance methods

[Source]

# File lib/more/facets/pathlist.rb, line 63
  def to_s
    join(File::PATH_SEPARATOR)
  end

[Validate]