momentarily 0.0.4 → 0.0.6

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: a05d24a13b45062b953a411b45b527499a061327
4
- data.tar.gz: 685a43ebfb9f9c80e5bca462d6b2cd95dbd70a85
3
+ metadata.gz: 4eea39d03678c3767a0aa7fc8ad41a26cdf2480c
4
+ data.tar.gz: 5127c379c8bb101d7d4eccaafa49ec3840234535
5
5
  SHA512:
6
- metadata.gz: 3a7d155f4d14dc2225ff2ad01736f55a2aeb89b6cdafa2f3e83acb1766d1cd501cff88a2889026ca428e2099efe37e5b41885c4b210f68ff1af52700a269311c
7
- data.tar.gz: 3939de0a9b56f71c241c5755e61987af4df70f4740e29ea5295dc55dbcbaafbb310ae04ec82532d2a8c2b6d91b2cf44df3c654822e5dd1955d7b995f13b6c627
6
+ metadata.gz: 31eab64be3b5cf889acdb8a8410e831881d8a607fc0879d8427af4d9a48a36d8c3a46e1b5a1dbd12969f3ec2bd5f92e4866d2945709637d5fcf1420698ba07f9
7
+ data.tar.gz: c65f4d1c8487c714ac2a52cba6ff9065d3a1f84bcd4779dabde787a541d76f6abf0eb498d3653257cebc94b85af64804a41d7a41a24de3a51e882f9f448ad3bb
@@ -16,12 +16,14 @@ You'll then need to start the reactor. Create a *config/initializers/momentarily
16
16
 
17
17
  <pre><code>
18
18
  Momentarily.start
19
+
20
+ # if classes aren't cached they will disappear from thread
21
+ # or we are testing for conditions, just run the code immediately
22
+ Momentarily.inline = true if Rails.env.development? || Rails.env.test?
19
23
  </code></pre>
20
24
 
21
25
  That's it! Once complete, *Momentarily.reactor_running?* should be true.
22
26
 
23
- Note that momentarily will not defer tasks if Rails.env.test? is true.
24
-
25
27
  Momentarily provides the very useful "later" command. Calling .later will spawn a thread to complete the tasks you provide, allowing your Rails requests to complete and return to users. For example:
26
28
 
27
29
  <pre><code>
@@ -14,6 +14,7 @@ module Momentarily
14
14
  mattr_accessor :timeout, :debug
15
15
  @@timeout = 60
16
16
  @@debug = false
17
+ @@inline = false
17
18
 
18
19
  def Momentarily.start
19
20
  # faciliates debugging
@@ -50,7 +51,7 @@ module Momentarily
50
51
  end
51
52
 
52
53
  def Momentarily.later(work = nil, callback = nil, &block)
53
- if Rails.env.test?
54
+ if @@inline
54
55
  (work || block).call
55
56
  callback.call unless callback.blank?
56
57
  else
@@ -1,3 +1,3 @@
1
1
  module Momentarily
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: momentarily
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Siler