Sha256: 3bbb3af18558211c62aedb4675ade308ef7f41d6d802bb4e04aaffec2aacc6ce
Contents?: true
Size: 735 Bytes
Versions: 13
Compression:
Stored size: 735 Bytes
Contents
class SmartIoC::BeanLocator include SmartIoC::Args BEAN_PATTERN = /bean\s+(:[a-zA-z0-9\-\_]+)/ # @param package_name [Symbol] package name for bean (ex: :repository) # @param dir [String] absolute path for directory with bean definitions # @return nil def locate_beans(package_name, dir) check_arg(package_name, :package_name, Symbol) Dir.glob(File.join(dir, '**/*.rb')).each do |file_path| File.readlines(file_path).each do |line| match_data = line.match(BEAN_PATTERN) if match_data SmartIoC::BeanLocations.add_bean( package_name, match_data.captures.first.gsub(':', '').to_sym, file_path ) break end end end nil end end
Version data entries
13 entries across 13 versions & 1 rubygems