Class: IntercomRails::Config
Constant Summary
collapse
- CUSTOM_DATA_VALIDATOR =
Proc.new do |custom_data, field_name|
case custom_data
when 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
when Proc, Symbol
else
raise ArgumentError, "#{field_name} custom_data should be either be a hash or a Proc/Symbol that returns a hash when called"
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
config_accessor, config_group, config_reader, config_writer, meta_class
Class Method Details
.api_key= ⇒ Object
113
114
115
|
# File 'lib/intercom-rails/config.rb', line 113
def self.api_key=(*)
warn "Setting an Intercom API key is no longer supported; remove the `config.api_key = ...` line from config/initializers/intercom.rb"
end
|
.reset! ⇒ Object
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/intercom-rails/config.rb', line 93
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
|