class Kfc
Constants
- LOOKUP_MAX_ROUNDS
- LOOKUP_ROUND_DELAY
Public Class Methods
Source
# File plugins/kfc.rb, line 62 def self.build_tracking_fetch(fetch) error_count = 0 tracking_fetch = lambda do |url, **fetch_opts| fetch.call(url, **fetch_opts) rescue *KfcFetch::TRANSIENT_ERRORS => e error_count += 1 if KfcFetch.transient_error?(e) raise end [tracking_fetch, -> { error_count }] end
Source
# File plugins/kfc.rb, line 20 def self.command_pattern /kfc(?:\s+(.+))?$/i end
Source
# File plugins/kfc.rb, line 78 def self.default_fetch(url, headers: nil) KfcApi.live_fetch(url) end
Source
# File plugins/kfc.rb, line 26 def self.dispatch_command(args_text, lookup: nil) parsed = KfcStores.parse_location(args_text) return { error: parsed[:error] } if parsed[:error] lookup ||= ->(location, **) { lookup_menu(location) } { reply: lookup.call(parsed[:location]) } end
Source
# File plugins/kfc.rb, line 74 def self.store_lookup_failed?(report) report.to_s.include?("Could not find a KFC store") end
Public Instance Methods
Source
# File plugins/kfc.rb, line 82 def execute(m, args_text) result = self.class.dispatch_command(args_text) if result[:error] themed_flood_safe_reply(m, result[:error]) return end themed_flood_safe_reply(m, result[:reply]) if result[:reply] end