Class: Twitch::Bot::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/twitch/bot/config.rb

Overview

This class stores the connection details for the client.

Instance Method Summary collapse

Constructor Details

#initialize(settings: {}) ⇒ Config

Returns a new instance of Config.



7
8
9
# File 'lib/twitch/bot/config.rb', line 7

def initialize(settings: {})
  @settings = settings
end

Instance Method Details

#setting(name) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/twitch/bot/config.rb', line 11

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