Sha256: 4951c217012162fb88582c2f0d9b2d57461c9d8e65e95645121b3c9c4e87bcae

Contents?: true

Size: 611 Bytes

Versions: 8

Compression:

Stored size: 611 Bytes

Contents

# frozen_string_literal: true

require_relative 'notifier/honeybadger_strategy'
require_relative 'notifier/null_strategy'
require_relative 'notifier/raise_strategy'

module JunkDrawer
  # class to send dev notifications to different channels
  class Notifier

    include Callable

    class << self

      attr_accessor :strategy

    end

    STRATEGIES = {
      honeybadger: HoneybadgerStrategy,
      raise: RaiseStrategy,
      null: NullStrategy,
    }.freeze

    def call(*args)
      strategy.(*args)
    end

  private

    def strategy
      STRATEGIES.fetch(self.class.strategy)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
junk_drawer-1.6.3 lib/junk_drawer/notifier.rb
junk_drawer-1.6.2 lib/junk_drawer/notifier.rb
junk_drawer-1.6.1 lib/junk_drawer/notifier.rb
junk_drawer-1.6.0 lib/junk_drawer/notifier.rb
junk_drawer-1.5.0 lib/junk_drawer/notifier.rb
junk_drawer-1.4.0 lib/junk_drawer/notifier.rb
junk_drawer-1.3.0 lib/junk_drawer/notifier.rb
junk_drawer-1.2.1 lib/junk_drawer/notifier.rb