Sha256: 5b5710043928b6172095b39437dcab13383ba043f2b56b136dec83a6efbee914

Contents?: true

Size: 509 Bytes

Versions: 14

Compression:

Stored size: 509 Bytes

Contents

# frozen_string_literal: true

module Twitch
  module Bot
    # This class stores the connection details for the client.
    class Config
      def initialize(settings: {})
        @settings = settings
      end

      def setting(name)
        conf = settings
        name_str = name.to_s
        name_str.split("_").each do |key|
          return nil if conf.nil?

          conf = conf.fetch(key.to_sym, nil)
        end
        conf
      end

      private

      attr_reader :settings
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
twitch-bot-6.0.0 lib/twitch/bot/config.rb
twitch-bot-5.0.6 lib/twitch/bot/config.rb
twitch-bot-5.0.5 lib/twitch/bot/config.rb
twitch-bot-5.0.4 lib/twitch/bot/config.rb
twitch-bot-5.0.2 lib/twitch/bot/config.rb
twitch-bot-5.0.1 lib/twitch/bot/config.rb
twitch-bot-5.0.0 lib/twitch/bot/config.rb
twitch-bot-4.1.1 lib/twitch/bot/config.rb
twitch-bot-4.1.0 lib/twitch/bot/config.rb
twitch-bot-4.0.1 lib/twitch/bot/config.rb
twitch-bot-4.0.0 lib/twitch/bot/config.rb
twitch-bot-3.2.1 lib/twitch/bot/config.rb
twitch-bot-3.2.0 lib/twitch/bot/config.rb
twitch-bot-3.1.0 lib/twitch/bot/config.rb