Class: IntercomRails::Config
- Inherits:
-
ConfigSingleton
- Object
- ConfigSingleton
- IntercomRails::Config
- Defined in:
- lib/intercom-rails/config.rb
Constant Summary collapse
- CUSTOM_DATA_VALIDATOR =
Proc.new do |custom_data, field_name| raise ArgumentError, "#{field_name} custom_data should be a hash" unless custom_data.kind_of?(Hash) unless custom_data.values.all? { |value| value.kind_of?(Proc) || value.kind_of?(Symbol) } raise ArgumentError, "all custom_data attributes should be either a Proc or a symbol" end end
- ARRAY_VALIDATOR =
Proc.new do |data, field_name| raise ArgumentError, "#{field_name} data should be an Array" unless data.kind_of?(Array) end
- IS_PROC_VALIDATOR =
Proc.new do |value, field_name| raise ArgumentError, "#{field_name} is not a proc" unless value.kind_of?(Proc) end
- IS_ARAY_OF_PROC_VALIDATOR =
Proc.new do |data, field_name| raise ArgumentError, "#{field_name} data should be a proc or an array of proc" unless data.all? { |value| value.kind_of?(Proc)} end
- IS_PROC_OR_ARRAY_OF_PROC_VALIDATOR =
Proc.new do |data, field_name| if data.kind_of?(Array) IS_ARAY_OF_PROC_VALIDATOR.call(data, field_name) else IS_PROC_VALIDATOR.call(data, field_name) end end
Class Method Summary collapse
Methods inherited from ConfigSingleton
config_accessor, config_group, config_reader, config_writer, meta_class
Class Method Details
.reset! ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/intercom-rails/config.rb', line 83 def self.reset! to_reset = self.constants.map {|c| const_get c} to_reset << self to_reset.each do |configer| configer.instance_variables.each do |var| configer.send(:remove_instance_variable, var) end end end |