Sha256: 3736931acd11ac76cdbcb550f93946ec933fc401118940e835eae51e7e32022f

Contents?: true

Size: 677 Bytes

Versions: 22

Compression:

Stored size: 677 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
      %i[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

22 entries across 22 versions & 2 rubygems

Version Path
thredded-0.15.4 lib/thredded/base_notifier.rb
thredded-0.15.3 lib/thredded/base_notifier.rb
thredded-0.15.2 lib/thredded/base_notifier.rb
thredded-0.15.1 lib/thredded/base_notifier.rb
threddedDANIEL-0.14.5 lib/thredded/base_notifier.rb
thredded-0.14.4 lib/thredded/base_notifier.rb
thredded-0.14.3 lib/thredded/base_notifier.rb
thredded-0.14.2 lib/thredded/base_notifier.rb
thredded-0.14.1 lib/thredded/base_notifier.rb
thredded-0.14.0 lib/thredded/base_notifier.rb
thredded-0.13.8 lib/thredded/base_notifier.rb
thredded-0.13.7 lib/thredded/base_notifier.rb
thredded-0.13.6 lib/thredded/base_notifier.rb
thredded-0.13.5 lib/thredded/base_notifier.rb
thredded-0.13.4 lib/thredded/base_notifier.rb
thredded-0.13.3 app/notifiers/thredded/base_notifier.rb
thredded-0.13.2 app/notifiers/thredded/base_notifier.rb
thredded-0.13.1 app/notifiers/thredded/base_notifier.rb
thredded-0.13.0 app/notifiers/thredded/base_notifier.rb
thredded-0.12.4 app/notifiers/thredded/base_notifier.rb