lib/intercom-rails/proxy.rb in intercom-rails-0.3.2 vs lib/intercom-rails/proxy.rb in intercom-rails-0.3.3

- old
+ new

@@ -127,19 +127,22 @@ {} end def custom_data_from_config return {} if config.custom_data.blank? - config.custom_data.reduce({}) do |custom_data, (k,v)| - custom_data.merge(k => custom_data_value_from_proc_or_symbol(v)) - end + custom_data_value(config.custom_data) end - def custom_data_value_from_proc_or_symbol(proc_or_symbol) - if proc_or_symbol.kind_of?(Symbol) - proxied_object.send(proc_or_symbol) - elsif proc_or_symbol.kind_of?(Proc) - proc_or_symbol.call(proxied_object) + def custom_data_value(proc_or_symbol_or_hash) + case proc_or_symbol_or_hash + when Symbol + proxied_object.send(proc_or_symbol_or_hash) + when Proc + proc_or_symbol_or_hash.call(proxied_object) + when Hash + proc_or_symbol_or_hash.reduce({}) do |custom_data, (k,v)| + custom_data.merge(k => custom_data_value(v)) + end end end end