Class: IntercomRails::Config

Inherits:
ConfigSingleton show all
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

Class Method Summary collapse

Methods inherited from ConfigSingleton

config_accessor, config_group, config_reader, config_writer, meta_class

Class Method Details

.reset!Object


71
72
73
74
75
76
77
78
79
80
# File 'lib/intercom-rails/config.rb', line 71

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