thread_ancestors 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/lib/thread_ancestors/version.rb +3 -0
- data/lib/thread_ancestors.rb +21 -0
- metadata +46 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ffc4eaa457d7449652f0170e886bbfb9e65d3a02
|
4
|
+
data.tar.gz: 5c8d43d0c789871951dfa73615faf0b35a011a39
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7e564c6baf119ec65751631129bb460ad18afa078f7207a7694d2677612c92ac8948eb94a634881d9418e411af59296df8b645ec899e09999b901481ab48b1d6
|
7
|
+
data.tar.gz: 26c88e3877e635c1dc0dba65ffa5d4f816adc41035d27fcbeb1349f393472beada9f2af0b0a8abdd12b0bd01d82555ba7b22dfe195d7ea75db6b49246808dfd1
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (C) 2013 Adam Hart <pididiot1@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ThreadAncestors
|
2
|
+
def initialize
|
3
|
+
@_parent = Thread.current
|
4
|
+
super
|
5
|
+
end
|
6
|
+
|
7
|
+
def ancestors
|
8
|
+
Enumerator.new do |enum|
|
9
|
+
t = Thread.current
|
10
|
+
while t = t.parent
|
11
|
+
enum.yield t
|
12
|
+
end
|
13
|
+
end.lazy
|
14
|
+
end
|
15
|
+
|
16
|
+
def parent
|
17
|
+
@_parent
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Thread.prepend(ThreadAncestors)
|
metadata
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thread_ancestors
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Hart
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description:
|
14
|
+
email: pididiot1@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- MIT-LICENSE
|
20
|
+
- lib/thread_ancestors.rb
|
21
|
+
- lib/thread_ancestors/version.rb
|
22
|
+
homepage: https://github.com/adam-hart/thread_ancestors
|
23
|
+
licenses:
|
24
|
+
- MIT
|
25
|
+
metadata: {}
|
26
|
+
post_install_message:
|
27
|
+
rdoc_options: []
|
28
|
+
require_paths:
|
29
|
+
- lib
|
30
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.1.0
|
35
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
requirements: []
|
41
|
+
rubyforge_project:
|
42
|
+
rubygems_version: 2.4.5
|
43
|
+
signing_key:
|
44
|
+
specification_version: 4
|
45
|
+
summary: Allows Thread to carry context from ancestors.
|
46
|
+
test_files: []
|