depth_first 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +2 -0
- data/lib/depth_first/parallel_organizer.rb +25 -0
- data/lib/depth_first/serial_organizer.rb +18 -0
- data/lib/depth_first/task.rb +14 -0
- data/lib/depth_first/version.rb +3 -0
- data/lib/depth_first.rb +8 -0
- metadata +78 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1e1a1087847cba4b518aea026bfc02ac889f3ff3
|
4
|
+
data.tar.gz: f1d8a89c7a5e9a46c51735709154c521e6ab1dbd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b8e6b05de5f0f60b6197bf05daade2a49de38734c948f199e971b1db29547dee1723399940d7ab2e3dd739dd7dbc7bc7caa2c420f2d2dfe69104cf1d445fc885
|
7
|
+
data.tar.gz: 8f37ab11c9375726cf697bc8efb4b6e2c9445d059763e1396f08dfa0ed3958102fea66f816136ba063936326487cc82d000d96dc2bec360aa5bb1fff48a7b60c
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module DepthFirst
|
2
|
+
# Base parallel organizer class
|
3
|
+
class ParallelOrganizer < Task
|
4
|
+
TASKS = [].freeze
|
5
|
+
|
6
|
+
def perform
|
7
|
+
tasks.map { |task| execute_promise(task) }
|
8
|
+
.reduce(options) { |a, e| resolve_promise(a, e) }
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def tasks
|
14
|
+
self.class::TASKS
|
15
|
+
end
|
16
|
+
|
17
|
+
def execute_promise(task)
|
18
|
+
Concurrent::Promise.new { task.new(options).perform }.execute
|
19
|
+
end
|
20
|
+
|
21
|
+
def resolve_promise(hsh, result)
|
22
|
+
hsh.merge(result.value)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module DepthFirst
|
2
|
+
# Base serial organizer class
|
3
|
+
class SerialOrganizer < Task
|
4
|
+
TASKS = [].freeze
|
5
|
+
|
6
|
+
def perform
|
7
|
+
tasks.reduce(options) do |hsh, task|
|
8
|
+
hsh.merge(task.new(hsh).perform)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def tasks
|
15
|
+
self.class::TASKS
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/depth_first.rb
ADDED
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: depth_first
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Isaac Anthony
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: concurrent-ruby
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rubocop
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.49.1
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.49.1
|
41
|
+
description: Chain together code tasks similar to Unix pipes
|
42
|
+
email: ianthony@optoro.com
|
43
|
+
executables: []
|
44
|
+
extensions: []
|
45
|
+
extra_rdoc_files: []
|
46
|
+
files:
|
47
|
+
- LICENSE
|
48
|
+
- README.md
|
49
|
+
- lib/depth_first.rb
|
50
|
+
- lib/depth_first/parallel_organizer.rb
|
51
|
+
- lib/depth_first/serial_organizer.rb
|
52
|
+
- lib/depth_first/task.rb
|
53
|
+
- lib/depth_first/version.rb
|
54
|
+
homepage: https://github.com/isaacanthony/depth_first
|
55
|
+
licenses:
|
56
|
+
- MIT
|
57
|
+
metadata: {}
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
requirements: []
|
73
|
+
rubyforge_project:
|
74
|
+
rubygems_version: 2.6.12
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Depth-first code organization pattern
|
78
|
+
test_files: []
|