Sha256: fee25bcf9e0a0ff42644150c56757243e9c0f4b4685f6b996d72c7dbc5270d97

Contents?: true

Size: 655 Bytes

Versions: 20

Compression:

Stored size: 655 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|
        fail "#{notifier.class.name} must respond to ##{m}" unless notifier.respond_to?(m)
      end
    end

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

      attr_reader :enabled

      def enabled?
        enabled
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
thredded-1.1.0 lib/thredded/base_notifier.rb
thredded-1.0.1 lib/thredded/base_notifier.rb
thredded-1.0.0 lib/thredded/base_notifier.rb
thredded-0.16.16 lib/thredded/base_notifier.rb
thredded-0.16.15 lib/thredded/base_notifier.rb
thredded-0.16.14 lib/thredded/base_notifier.rb
thredded-0.16.13 lib/thredded/base_notifier.rb
thredded-0.16.12 lib/thredded/base_notifier.rb
thredded-0.16.11 lib/thredded/base_notifier.rb
thredded-0.16.10 lib/thredded/base_notifier.rb
thredded-0.16.9 lib/thredded/base_notifier.rb
thredded-0.16.8 lib/thredded/base_notifier.rb
thredded-0.16.7 lib/thredded/base_notifier.rb
thredded-0.16.6 lib/thredded/base_notifier.rb
thredded-0.16.5 lib/thredded/base_notifier.rb
thredded-0.16.4 lib/thredded/base_notifier.rb
thredded-0.16.3 lib/thredded/base_notifier.rb
thredded-0.16.1 lib/thredded/base_notifier.rb
thredded-0.16.0 lib/thredded/base_notifier.rb
thredded-0.15.5 lib/thredded/base_notifier.rb