Class: Yalphabetize::YamlFinder
- Inherits:
-
Object
- Object
- Yalphabetize::YamlFinder
- Defined in:
- lib/yalphabetize/yaml_finder.rb
Constant Summary collapse
- YAML_EXTENSIONS =
%w[.yml .yaml].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ YamlFinder
constructor
A new instance of YamlFinder.
- #paths(paths) ⇒ Object
Constructor Details
#initialize ⇒ YamlFinder
Returns a new instance of YamlFinder.
17 18 19 |
# File 'lib/yalphabetize/yaml_finder.rb', line 17 def initialize @files = [] end |
Class Method Details
.paths(only:, exclude:) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/yalphabetize/yaml_finder.rb', line 9 def self.paths(only:, exclude:) if exclude.any? new.paths(only) - new.paths(exclude) else new.paths(only) end end |
Instance Method Details
#paths(paths) ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/yalphabetize/yaml_finder.rb', line 21 def paths(paths) if paths.empty? files << files_in_dir else process_paths(paths) end files.flatten.select { |file| valid?(file) }.map { |f| File.(f) }.uniq end |