Module: PoolParty::SearchablePaths::ClassMethods

Defined in:
lib/poolparty/modules/searchable_paths.rb

Instance Method Summary collapse

Instance Method Details

#has_searchable_paths(opts = {}) ⇒ Object

Specify that a particular class has methods for searchable paths.

Options:

  • :dirs: array of directories to look in under the search paths. (default: ["/"])

  • :dir: set the directory to look in under the search paths. Use either dir or dirs, not both. (default: /)

  • :paths: overwrite all default paths and set the paths to this array exactly

  • :append_paths: append these paths to any existing paths

  • :prepend_paths: prepend these paths to any existing paths



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/poolparty/modules/searchable_paths.rb', line 22

def has_searchable_paths(opts={})
  class_eval do
    extend PoolParty::SearchablePaths::SingletonMethods

    @searchable_paths_dirs = [opts[:dir]] if opts[:dir]
    @searchable_paths_dirs = opts[:dirs]  if opts[:dirs]
    @paths_override        = opts[:paths] if opts[:paths]
    @paths_prepend         = opts[:prepend_paths] || []
    @paths_append          = opts[:append_paths]  || []
  end
  include PoolParty::SearchablePaths::InstanceMethods
end