lib/sibit/bestof.rb in sibit-0.19.4 vs lib/sibit/bestof.rb in sibit-0.20.0

- old
+ new

@@ -30,13 +30,14 @@ # License:: MIT class Sibit # Best of API. class BestOf # Constructor. - def initialize(list, log: Sibit::Log.new) + def initialize(list, log: Sibit::Log.new, verbose: false) @list = list @log = log + @verbose = verbose end # Current price of BTC in USD (float returned). def price(currency = 'USD') best_of('price') do |api| @@ -104,10 +105,10 @@ results = [] @list.each do |api| begin results << yield(api) rescue Sibit::Error => e - @log.info("The API #{api.class.name} failed at #{method}(): #{e.message}") + @log.info("The API #{api.class.name} failed at #{method}(): #{e.message}") if @verbose end end if results.empty? raise Sibit::Error, "No APIs out of #{@list.length} managed to succeed at #{method}(): \ #{@list.map { |a| a.class.name }.join(', ')}"