Class: Yalphabetize::YamlFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/yalphabetize/yaml_finder.rb

Constant Summary collapse

YAML_EXTENSIONS =
%w[.yml .yaml].freeze

Instance Method Summary collapse

Constructor Details

#initializeYamlFinder

Returns a new instance of YamlFinder.



9
10
11
# File 'lib/yalphabetize/yaml_finder.rb', line 9

def initialize
  @files = []
end

Instance Method Details

#paths(paths) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/yalphabetize/yaml_finder.rb', line 13

def paths(paths)
  if paths.empty?
    files << files_in_dir
  else
    process_paths(paths)
  end

  files.flatten.select(&method(:valid?)).map { |f| File.expand_path(f) }.uniq
end