| 
									
										
										
										
											2022-01-03 14:59:10 +00:00
										 |  |  | # typed: true | 
					
						
							|  |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Formula | 
					
						
							|  |  |  |   extend Enumerable | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def self.each(&_block) | 
					
						
							| 
									
										
										
										
											2022-05-30 14:59:14 +01:00
										 |  |  |     odisabled "`Enumerable` methods on `Formula`", | 
					
						
							|  |  |  |               "`Formula.all` (but avoid looping over all formulae, it's slow and insecure)" | 
					
						
							| 
									
										
										
										
											2022-01-03 14:59:10 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     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 |