Module: FlowChat::NamedConfiguration::ClassMethods
- Defined in:
- lib/flow_chat/named_configuration.rb
Instance Method Summary collapse
- #clear_all! ⇒ Object
-
#configuration_label ⇒ Object
The platform's name as it appears in the not-found message.
- #configuration_names ⇒ Object
- #exists?(name) ⇒ Boolean
- #get(name) ⇒ Object
- #register(name, config) ⇒ Object
Instance Method Details
#clear_all! ⇒ Object
37 38 39 40 |
# File 'lib/flow_chat/named_configuration.rb', line 37 def clear_all! FlowChat.logger.debug { "#{name}: Clearing all registered configurations" } configurations.clear end |
#configuration_label ⇒ Object
The platform's name as it appears in the not-found message. Overridden where the constant name and the product name differ, as with WhatsApp.
44 45 46 |
# File 'lib/flow_chat/named_configuration.rb', line 44 def configuration_label name.split("::")[-2] end |
#configuration_names ⇒ Object
33 34 35 |
# File 'lib/flow_chat/named_configuration.rb', line 33 def configuration_names configurations.keys end |
#exists?(name) ⇒ Boolean
29 30 31 |
# File 'lib/flow_chat/named_configuration.rb', line 29 def exists?(name) configurations.key?(name.to_sym) end |
#get(name) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/flow_chat/named_configuration.rb', line 18 def get(name) config = configurations[name.to_sym] unless config FlowChat.logger.error { "#{self.name}: Configuration '#{name}' not found" } raise ArgumentError, "#{configuration_label} configuration '#{name}' not found" end FlowChat.logger.debug { "#{self.name}: Retrieved configuration '#{name}'" } config end |