Class: Ordit::Definitions
- Inherits:
-
Object
- Object
- Ordit::Definitions
- Defined in:
- lib/ordit/definitions.rb
Class Method Summary collapse
Class Method Details
.all ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/ordit/definitions.rb', line 5 def self.all Ordit.configuration.view_paths.each_with_object({}) do |path, hash| Dir.glob(path.to_s).each do |file| content = File.read(file) matches = DefinitionMatcher.run(content) next if matches.empty? matches.each do |match| relative_file = Pathname.new(file).relative_path_from( Pathname.new(Ordit.root) ).to_s hash[match] ||= [] hash[match] |= [relative_file] end end end end |