21 lines
		
	
	
		
			555 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
		
		
			
		
	
	
			21 lines
		
	
	
		
			555 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
|   | # typed: true | ||
|  | # frozen_string_literal: true | ||
|  | 
 | ||
|  | class Formula | ||
|  |   extend Enumerable | ||
|  | 
 | ||
|  |   def self.each(&_block) | ||
|  |     # TODO: 3.4.0: odeprecated "`Enumerable` methods on `Formula`", | ||
|  |     #              "`Formula.all` (but avoid looping over all formulae, it's slow and insecure)" | ||
|  | 
 | ||
|  |     files.each do |file| | ||
|  |       yield Formulary.factory(file) | ||
|  |     rescue FormulaUnavailableError, FormulaUnreadableError => e | ||
|  |       # Don't let one broken formula break commands. But do complain. | ||
|  |       onoe "Failed to import: #{file}" | ||
|  |       $stderr.puts e | ||
|  |       next | ||
|  |     end | ||
|  |   end | ||
|  | end |