Module: Finder::Find::Site
- Includes:
- Base
- Defined in:
- lib/finder/site.rb
Overview
System location finder methods.
Constant Summary collapse
- DATA_PATH =
System’s data path.
RbConfig::CONFIG['datadir']
Instance Method Summary collapse
-
#data_path(match, options = {}) ⇒ Object
Search data path.
-
#load_path(match, options = {}) ⇒ Array<String>
Search load path for matching patterns.
-
#path(match, options = {}) ⇒ Array<String>
Search load path for matching patterns.
Methods included from Base
#append_extensions, #feature, included, #valid_load_options
Instance Method Details
#data_path(match, options = {}) ⇒ Object
Search data path.
77 78 79 80 81 |
# File 'lib/finder/site.rb', line 77 def data_path(match, ={}) return [] if [:from] Dir.glob(File.join(DATA_PATH, match)).uniq end |
#load_path(match, options = {}) ⇒ Array<String>
Search load path for matching patterns.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/finder/site.rb', line 55 def load_path(match, ={}) return [] if [:from] = () found = [] $LOAD_PATH.uniq.each do |path| list = Dir.glob(File.join(File.(path), match)) list = list.map{ |d| d.chomp('/') } # return absolute path unless relative flag if [:relative] # the extra '' in File.join adds a '/' to the end of the path list = list.map{ |f| f.sub(File.join(path, ''), '') } end found.concat(list) end found end |
#path(match, options = {}) ⇒ Array<String>
Search load path for matching patterns.
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/finder/site.rb', line 28 def path(match, ={}) return [] if [:from] found = [] $LOAD_PATH.uniq.map do |path| list = Dir.glob(File.join(File.(path), match)) list = list.map{ |d| d.chomp('/') } found.concat(list) end found.concat(data_path(match, )) found end |