Method: Translatomatic::ResourceFile.find

Defined in:
lib/translatomatic/resource_file.rb

.find(path, options = {}) ⇒ Array<Translatomatic::ResourceFile>

Find all resource files under the given directory. Follows symlinks.

Parameters:

  • path (String, Pathname)

    The path to search from

Returns:



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/translatomatic/resource_file.rb', line 31

def self.find(path, options = {})
  files = []
  include_dot_directories = options[:include_dot_directories]
  path = Pathname.new(path) unless path.kind_of?(Pathname)
  path.find do |file|
    if !include_dot_directories && file.basename.to_s[0] == ?.
      Find.prune
    else
      resource = load(file)
      files << resource if resource
    end
  end
  files
end