stream_rails 2.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e747d58bdea6d8fb3730c4c989473f80742aa27
4
- data.tar.gz: 7de3ea1b730b2ab6776357285fee6e828ab870f7
3
+ metadata.gz: 70c5b22ea342a9c2caa66521fcb38dd70adfcc14
4
+ data.tar.gz: 9cb603fa72c135002d2243d36d7134a8669e90c7
5
5
  SHA512:
6
- metadata.gz: 90acf4f1f8b17e3c8310f55b24bec008340b71772f8b831c8b8d740affc2503c826c6fc40d4f2c528d218591fe0344913c036f1666253c830d35a112e0bd5e88
7
- data.tar.gz: aad3af59da1f2b7c27c9f19ae47dc7c66a80cd1072d8a8ae0c7f3d6a1210d2ca4dcd206ae762e3db2fe11395b225393795d522e9ad8db3842ceef8dea8c63fbf
6
+ metadata.gz: 6f32e2070d44937683e0ee1b7367fc12ac74d24012d9eca6e5f8d135702b71d63bdbea792ebdfc302b83f9e91af7ab8b25b13a92630c8e91ea3148c94fe3ac8b
7
+ data.tar.gz: a690422094cc32d3254e125a7a105b7e60724de99e56cd361aada66f8441e13ba888946506ee15bb0f9056718b0cf9f8d162cac82288ec17e1f25401de6e56eb
data/README.md CHANGED
@@ -287,4 +287,12 @@ eg. adds the extra_var to the partial scope
287
287
  <%= render_activity activity, :locals => {:extra_var => 42} %>
288
288
  ```
289
289
 
290
+ ### Disable model tracking
290
291
 
292
+ You can disable model tracking (eg. when you run tests) via StreamRails.configure
293
+
294
+ ```
295
+ require 'stream_rails'
296
+
297
+ StreamRails.enabled = false
298
+ ```
@@ -47,14 +47,18 @@ module StreamRails
47
47
  end
48
48
 
49
49
  def created_activity(instance)
50
- activity = instance.create_activity
51
- feed = self.get_owner_feed(instance)
52
- feed.add_activity(activity)
50
+ if StreamRails::enabled?
51
+ activity = instance.create_activity
52
+ feed = self.get_owner_feed(instance)
53
+ feed.add_activity(activity)
54
+ end
53
55
  end
54
56
 
55
57
  def destroyed_activity(instance)
56
- feed = self.get_owner_feed(instance)
57
- feed.remove(instance.activity_foreign_id, foreign_id=true)
58
+ if StreamRails::enabled?
59
+ feed = self.get_owner_feed(instance)
60
+ feed.remove(instance.activity_foreign_id, foreign_id=true)
61
+ end
58
62
  end
59
63
 
60
64
  end
@@ -1,3 +1,3 @@
1
1
  module StreamRails
2
- VERSION = '2.1'
2
+ VERSION = '2.1.1'
3
3
  end
data/lib/stream_rails.rb CHANGED
@@ -22,6 +22,19 @@ module StreamRails
22
22
  @config ||= StreamRails::Config.new
23
23
  end
24
24
 
25
+ # Switches StreamRails on or off.
26
+ # @param value [Boolean]
27
+ def self.enabled=(value)
28
+ StreamRails.config.enabled = value
29
+ end
30
+
31
+ # Returns `true` if StreamRails is on, `false` otherwise.
32
+ # Enabled by default.
33
+ # @return [Boolean]
34
+ def self.enabled?
35
+ !!StreamRails.config.enabled
36
+ end
37
+
25
38
  # Returns StreamRails's configuration object.
26
39
  def self.feed_manager
27
40
  @feed_manager ||= StreamRails::FeedManager.new(self.client, self.config.feed_configs)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stream_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.1'
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommaso Barbugli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-14 00:00:00.000000000 Z
11
+ date: 2014-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack