not_now 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/not_now.rb +27 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2a98a289b7175b5c366cddd3ecf0c7041ed8fcd0
4
+ data.tar.gz: 55e25fe78468124778cbf3557a04b621a340dba9
5
+ SHA512:
6
+ metadata.gz: d270cfbb2d1edeb2d2975504027f1e64bdb6e47d7fa22f56504d701b78d120a0144bf3bccb2e788aefa98ccbaa04a4f8e18f422e560f66ce96bffa56414d8bdf
7
+ data.tar.gz: a458f68e4cd38ff82eaaa24bd38382ac34baa5884fe847cc6c4a822cc35b0db2abc2b00969440ea41e25bb6bce5760e9e9f2336fe09f7d4fb8f4198ed5754f3a
data/lib/not_now.rb ADDED
@@ -0,0 +1,27 @@
1
+ class NotNow
2
+ def self.call(blk)
3
+ self.new.(blk)
4
+ end
5
+
6
+ def initialize
7
+ @callbacks = []
8
+ end
9
+
10
+ def call(blk)
11
+ blk.call(later)
12
+ now
13
+ end
14
+
15
+ private
16
+ attr_reader :callbacks
17
+
18
+ def later
19
+ @later ||= -> (callback) { callbacks.push(callback) }
20
+ end
21
+
22
+ def now
23
+ until callbacks.empty?
24
+ callbacks.shift.()
25
+ end
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: not_now
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Daniel Colson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-30 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Run code later
14
+ email: danieljamescolson@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/not_now.rb
20
+ homepage: https://github.com/composerinteralia/now_now
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.5.1
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Run code later
44
+ test_files: []