Sha256: 140a4c2c42470eeb1059b3f6f986adee2040c22b82c7482bd5dab7296953fb60
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
module Lita class Adapter attr_reader :robot class << self attr_reader :required_configs def require_config(*keys) @required_configs ||= [] @required_configs.concat(keys.flatten.map(&:to_sym)) end alias_method :require_configs, :require_config end def initialize(robot) @robot = robot ensure_required_configs end [:run, :send_messages, :set_topic, :shut_down].each do |method| define_method(method) do |*args| Lita.logger.warn("This adapter has not implemented ##{method}.") end end private def ensure_required_configs required_configs = self.class.required_configs return if required_configs.nil? missing_keys = [] required_configs.each do |key| missing_keys << key unless Lita.config.adapter[key] end unless missing_keys.empty? Lita.logger.fatal( "The following keys are required on config.adapter: #{missing_keys.join(", ")}" ) abort end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
lita-1.1.2 | lib/lita/adapter.rb |
lita-1.1.1 | lib/lita/adapter.rb |
lita-1.1.0 | lib/lita/adapter.rb |
lita-1.0.0 | lib/lita/adapter.rb |