Sha256: c47ba8c7994f9e0c3d2adfbb60f47904a46e9e5151896f7a1d99fac4ebef25be

Contents?: true

Size: 680 Bytes

Versions: 10

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

module Thredded
  class BaseNotifier
    def self.validate_notifier(notifier)
      unless notifier.respond_to?(:key) && /^[a-z_]+$/.match(notifier.key)
        fail "Notifier problem: #{notifier.class.name} must respond to #key with a snake_case string"
      end
      [:human_name, :new_post, :new_private_post].each do |m|
        unless notifier.respond_to?(m)
          fail "#{notifier.class.name} must respond to ##{m}"
        end
      end
    end

    class NotificationsDefault
      def initialize(enabled)
        @enabled = enabled
      end

      attr_reader :enabled

      def enabled?
        enabled
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
thredded-0.12.1 app/notifiers/thredded/base_notifier.rb
thredded-0.12.0 app/notifiers/thredded/base_notifier.rb
thredded-0.11.1 app/notifiers/thredded/base_notifier.rb
thredded-0.11.0 app/notifiers/thredded/base_notifier.rb
thredded-0.10.1 app/notifiers/thredded/base_notifier.rb
thredded-0.10.0 app/notifiers/thredded/base_notifier.rb
thredded-0.9.4 app/notifiers/thredded/base_notifier.rb
thredded-0.9.3 app/notifiers/thredded/base_notifier.rb
thredded-0.9.2 app/notifiers/thredded/base_notifier.rb
thredded-0.9.1 app/notifiers/thredded/base_notifier.rb