multiple_man 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec0bfec609e5e0dde5ac05f5d2e27de78a8654d0
4
- data.tar.gz: 95de9a66641c0d9d724de0bc7ab92523b4359dc9
3
+ metadata.gz: 9c224684e5a19e767532489cf0f03389835dc9dd
4
+ data.tar.gz: c7e4b9d054b7f38ae40e99373f45a5dfe0b54893
5
5
  SHA512:
6
- metadata.gz: 4c26b2a50cb603b1981f3e50ef3a10335447ad906794718f3b581ec5b55f129ee015f909724ebc59671268e8538b11890b43d93634d3be6a0c6acef027a67bec
7
- data.tar.gz: 1e22f37d9e12047413de4df64f4dbcf0ff3244ef5a5456e1abb813873c9120e439d16bd32651280a78352c8aac1f0a73db91e67daf927f9b85e994407f886ef2
6
+ metadata.gz: f4f7b8003f504d147c574bb7fe7883f4272a123e246fa90600a26ae242c73ff7fc5920e8a773c2b77eb85c871abae541b6b10149cc69c6398fc6afb71eaf6f6b
7
+ data.tar.gz: 5b92ea800ed16bdfde4a2e51e1eef61c5c541dcd426b9ca766bd9480a4196c980fa5850321018123c4390293fa020d3073fb267c2b2481c22c7397445b3a33be
@@ -5,9 +5,10 @@ module MultipleMan
5
5
  self.topic_name = "multiple_man"
6
6
  self.app_name = Rails.application.class.parent.to_s if defined?(Rails)
7
7
  self.logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
8
+ self.enabled = true
8
9
  end
9
10
 
10
- attr_accessor :topic_name, :app_name, :connection, :logger
11
+ attr_accessor :topic_name, :app_name, :connection, :logger, :enabled
11
12
  end
12
13
 
13
14
  def self.configuration
@@ -7,6 +7,8 @@ module MultipleMan
7
7
  end
8
8
 
9
9
  def after_commit(record)
10
+ return unless MultipleMan.configuration.enabled
11
+
10
12
  MultipleMan.logger.info("Publishing #{record}")
11
13
  Connection.connect do |connection|
12
14
  push_record(connection, record)
@@ -1,3 +1,3 @@
1
1
  module MultipleMan
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/multiple_man.rb CHANGED
@@ -16,4 +16,12 @@ module MultipleMan
16
16
  def self.logger
17
17
  MultipleMan.configuration.logger
18
18
  end
19
+
20
+ def self.disable!
21
+ MultipleMan.configuration.enabled = false
22
+ end
23
+
24
+ def self.enable!
25
+ MultipleMan.configuration.enabled = true
26
+ end
19
27
  end
data/spec/logger_spec.rb CHANGED
@@ -4,9 +4,7 @@ describe MultipleMan do
4
4
  let(:mock_logger) { double(Logger) }
5
5
 
6
6
  before do
7
- MultipleMan.configure do |config|
8
- config.logger = mock_logger
9
- end
7
+ MultipleMan.configuration.stub(:logger).and_return(mock_logger)
10
8
  end
11
9
 
12
10
  it "should use the logger from configuration" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multiple_man
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brunner