Class: Piano::ControllerLoader
- Inherits:
-
Object
- Object
- Piano::ControllerLoader
- Defined in:
- lib/piano/controller_loader.rb
Overview
Handler of .controller files loading
Class Method Summary collapse
- .folder(path) ⇒ Object
-
.recursive(path, &block) ⇒ Object
Iterates recursively over the path and calls the block with each newfound file.
Class Method Details
.folder(path) ⇒ Object
4 5 6 7 8 |
# File 'lib/piano/controller_loader.rb', line 4 def self.folder path recursive path do |item| load item end end |
.recursive(path, &block) ⇒ Object
Iterates recursively over the path and calls the block with each newfound file
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/piano/controller_loader.rb', line 12 def self.recursive path, &block files = [] Dir.new(File.(path)).each do |file| if File.directory? "#{path}/#{file}" unless file == '..' or file == '.' recursive "#{path}/#{file}" do |item| files << "#{item}" end end elsif file.end_with? '.controller' files << "#{path}/#{file}" end end files.each { |item| block.call(item) } end |