class UniformNotifier::JavascriptConsole
Public Class Methods
active?()
click to toggle source
# File lib/uniform_notifier/javascript_console.rb, line 6 def active? !!UniformNotifier.console end
Protected Class Methods
_inline_notify(data)
click to toggle source
# File lib/uniform_notifier/javascript_console.rb, line 12 def _inline_notify(data) message = data.values.compact.join("\n") options = UniformNotifier.console.is_a?(Hash) ? UniformNotifier.console : {} script_attributes = options[:attributes] || {} code = <<~CODE if (typeof(console) !== 'undefined' && console.log) { if (console.groupCollapsed && console.groupEnd) { console.groupCollapsed(#{'Uniform Notifier'.inspect}); console.log(#{message.inspect}); console.groupEnd(); } else { console.log(#{message.inspect}); } } CODE wrap_js_association code, script_attributes end