class UniformNotifier::Base

Public Class Methods

active?() click to toggle source
# File lib/uniform_notifier/base.rb, line 6
def active?
  false
end
inline_notify(data) click to toggle source
# File lib/uniform_notifier/base.rb, line 10
def inline_notify(data)
  return unless active?

  # For compatibility to the old protocol
  data = { title: data } if data.is_a?(String)

  _inline_notify(data)
end
out_of_channel_notify(data) click to toggle source
# File lib/uniform_notifier/base.rb, line 19
def out_of_channel_notify(data)
  return unless active?

  # For compatibility to the old protocol
  data = { title: data } if data.is_a?(String)

  _out_of_channel_notify(data)
end

Protected Class Methods

_inline_notify(data) click to toggle source
# File lib/uniform_notifier/base.rb, line 30
def _inline_notify(data); end
_out_of_channel_notify(data) click to toggle source
# File lib/uniform_notifier/base.rb, line 32
def _out_of_channel_notify(data); end
wrap_js_association(code, attributes = {}) click to toggle source
# File lib/uniform_notifier/base.rb, line 34
      def wrap_js_association(code, attributes = {})
        attributes = { type: 'text/javascript' }.merge(attributes || {})
        attributes_string = attributes.map { |k, v| "#{k}=#{v.to_s.inspect}" }.join(' ')

        <<~CODE
          <script #{attributes_string}>/*<![CDATA[*/
          #{code}
          /*]]>*/</script>
        CODE
      end