lib/analytical.rb in analytical-3.0.6 vs lib/analytical.rb in analytical-3.0.7
- old
+ new
@@ -13,12 +13,18 @@
File.open("#{::Rails.root}/config/analytical.yml") do |f|
file_options = YAML::load(ERB.new(f.read).result).symbolize_keys
env = (::Rails.env || :production).to_sym
file_options = file_options[env] if file_options.has_key?(env)
file_options.each do |k, v|
- config_options[k.to_sym] = v.symbolize_keys
- config_options[:modules] << k.to_sym unless options && options[:modules]
+ if v.respond_to?(:symbolize_keys)
+ # module configuration
+ config_options[k.to_sym] = v.symbolize_keys
+ config_options[:modules] << k.to_sym unless options && options[:modules]
+ else
+ # regular option
+ config_options[k.to_sym] = v
+ end
end if file_options
end if File.exists?("#{::Rails.root}/config/analytical.yml")
self.analytical_options = self.analytical_options.reverse_merge config_options
end
@@ -36,10 +42,10 @@
options[:session] = session if options[:use_session_store]
if analytical_is_robot?(request.user_agent)
options[:modules] = []
end
options[:modules] = options[:filter_modules].call(self, options[:modules]) if options[:filter_modules]
- options[:javascript_helpers] ||= true
+ options[:javascript_helpers] ||= true if options[:javascript_helpers].nil?
Analytical::Api.new options
end
end
end