Module: SlackMessage::Configuration
- Defined in:
- lib/slack_message/configuration.rb
Constant Summary collapse
- @@profiles =
{}
- @@debug =
false
Class Method Summary collapse
- .add_profile(handle = :default, api_token:, name: nil, icon: nil, default_channel: nil) ⇒ Object
-
.clear_profiles! ⇒ Object
test harness, mainly.
- .configure {|_self| ... } ⇒ Object
- .debug ⇒ Object
- .debugging? ⇒ Boolean
- .profile(handle) ⇒ Object
- .reset ⇒ Object
Class Method Details
.add_profile(handle = :default, api_token:, name: nil, icon: nil, default_channel: nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/slack_message/configuration.rb', line 20 def self.add_profile(handle = :default, api_token:, name: nil, icon: nil, default_channel: nil) if @@profiles.include?(handle) warn "WARNING: Overriding profile '#{handle}' in SlackMessage config" end @@profiles[handle] = { handle: handle, api_token: api_token, name: name, icon: icon, default_channel: default_channel } end |
.clear_profiles! ⇒ Object
test harness, mainly
16 17 18 |
# File 'lib/slack_message/configuration.rb', line 16 def self.clear_profiles! # test harness, mainly @@profiles = {} end |
.configure {|_self| ... } ⇒ Object
10 11 12 |
# File 'lib/slack_message/configuration.rb', line 10 def self.configure yield self end |
.debug ⇒ Object
42 43 44 |
# File 'lib/slack_message/configuration.rb', line 42 def self.debug @@debug = true end |
.debugging? ⇒ Boolean
46 47 48 |
# File 'lib/slack_message/configuration.rb', line 46 def self.debugging? @@debug end |
.profile(handle) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/slack_message/configuration.rb', line 34 def self.profile(handle) unless @@profiles.include?(handle) raise ArgumentError, "Unknown SlackMessage profile '#{handle}'." end @@profiles[handle] end |
.reset ⇒ Object
5 6 7 8 |
# File 'lib/slack_message/configuration.rb', line 5 def self.reset @@profiles = {} @@debug = false end |