Module: Daigaku::Loadable
- Defined in:
- lib/daigaku/loadable.rb
Instance Method Summary collapse
Instance Method Details
#load(path) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/daigaku/loadable.rb', line 6 def load(path) if Dir.exist?(path) dirs = Dir.entries(path).select do |entry| !entry.match(/\./) end dirs.sort.map do |dir| dir_path = File.join(path, dir) class_name = self.to_s.demodulize.singularize "Daigaku::#{class_name}".constantize.new(dir_path) end else Array.new end end |