Module: Finder::Find

Extended by:
Find
Included in:
Find, Find
Defined in:
lib/finder/find.rb,
lib/finder/gem.rb,
lib/finder/base.rb,
lib/finder/roll.rb,
lib/finder/site.rb

Overview

Find module is the main interface for Finder library.

Defined Under Namespace

Modules: Base, Gem, Roll, Site

Constant Summary collapse

EXTENSIONS =

TODO: expand on extensions

%w{.rb .rbx .so}

Instance Method Summary collapse

Instance Method Details

#data_path(match, options = {}) ⇒ Object

Searching through all systems for matching data paths.

Examples:

Find.data_path('bar/*')

Parameters:

  • match (String)

    File glob to match against.



48
49
50
51
52
53
54
# File 'lib/finder/find.rb', line 48

def data_path(match, options={})
  found = []
  systems.each do |system|
    found.concat system.data_path(match, options)
  end
  found.uniq
end

#feature(match, options = {}) ⇒ Object

Searching through all systems for matching requirable feature files.

Examples:

Find.feature('ostruct')

Parameters:

  • match (String)

    File glob to match against.



96
97
98
99
100
101
102
# File 'lib/finder/find.rb', line 96

def feature(match, options={})
  found = []
  systems.each do |system|
    found.concat system.feature(match, options)
  end
  found.uniq
end

#load_path(match, options = {}) ⇒ Object

Searching through all systems for matching load paths.

Examples:

Find.load_path('bar/*')

Parameters:

  • match (String)

    File glob to match against.



64
65
66
67
68
69
70
# File 'lib/finder/find.rb', line 64

def load_path(match, options={})
  found = []
  systems.each do |system|
    found.concat system.load_path(match, options)
  end
  found.uniq
end

#path(match, options = {}) ⇒ Object Also known as: []

Find matching paths, searching through Rolled libraries, Gem-installed libraries and site locations in ‘$LOAD_PATH` and `RbConfig::CONFIG`.

Examples:

Find.path('lib/foo/*')

Parameters:

  • match (String)

    File glob to match against.



26
27
28
29
30
31
32
# File 'lib/finder/find.rb', line 26

def path(match, options={})
  found = []
  systems.each do |system|
    found.concat system.path(match, options)
  end
  found.uniq
end

#systemsObject

List of supported library management systems.



107
108
109
110
111
112
113
114
115
# File 'lib/finder/find.rb', line 107

def systems
  @systems ||= (
    systems = []
    systems << Roll if defined?(::Library)
    systems << Gem  if defined?(::Gem)
    systems << Site
    systems
  )
end