forester 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -6
- data/LICENSE +21 -0
- data/README.md +1 -1
- data/forester.gemspec +6 -1
- data/lib/forester/aggregators.rb +8 -6
- data/lib/forester/version.rb +1 -1
- metadata +44 -2
- data/Gemfile.lock +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a4e20df16f585d00c1a95192215a8d887140273
|
4
|
+
data.tar.gz: 888ae8d298b84192f43cb6b1c4eabef4c1bfa241
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 975ac6670f42492209f6884a9f4a353a5cce36ad04443f96e8aee398ac4a0824cfbe7711c75d3a04bb62bd2f0140fa357958e76ac3e206d950d389b05a7d7265
|
7
|
+
data.tar.gz: 1c0a9bcc4d165439e67582f680c85cc022678ce8db8a02a00c15f53497814e6dd3a17f24c1ee7d0b7d433eb8b07d00623765433446b985767764aac1ec1cc8b9
|
data/Gemfile
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 eugeniobruno
|
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
CHANGED
@@ -18,7 +18,7 @@ Because I didn't feel the need to copy the whole codebase. All I needed was to e
|
|
18
18
|
|
19
19
|
- What can I do with forester?
|
20
20
|
|
21
|
-
Everything you can do with rubytree, possibly in a more intention-revealing way, plus arbitrary, configurable aggregations on trees.
|
21
|
+
Everything you can do with rubytree, possibly in a more intention-revealing way, plus arbitrary, configurable aggregations on trees. Simple examples can be found in the tests.
|
22
22
|
|
23
23
|
## Installation
|
24
24
|
|
data/forester.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'forester/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'forester'
|
8
|
-
s.version =
|
8
|
+
s.version = Forester::Version
|
9
9
|
s.date = '2016-07-17'
|
10
10
|
s.summary = "A gem to represent and interact with tree data structures"
|
11
11
|
s.description = "Based on rubytree and enzymator, this gem lets you build trees and run queries against them."
|
@@ -21,4 +21,9 @@ Gem::Specification.new do |s|
|
|
21
21
|
|
22
22
|
s.add_runtime_dependency 'rubytree', ['~> 0.9']
|
23
23
|
s.add_runtime_dependency 'enzymator', ['~> 0.0']
|
24
|
+
|
25
|
+
s.add_development_dependency 'rake', ['~> 11.2']
|
26
|
+
s.add_development_dependency 'minitest', ['~> 5.9']
|
27
|
+
s.add_development_dependency 'pry-byebug', ['~> 3.4']
|
28
|
+
|
24
29
|
end
|
data/lib/forester/aggregators.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
1
|
module Forester
|
2
2
|
module Aggregators
|
3
3
|
|
4
|
-
def aggregate(config)
|
5
|
-
Enzymator::Aggregation.new(config).run_on(self)
|
6
|
-
end
|
7
|
-
|
8
4
|
def values_by_subtree_of_level(options = {})
|
9
5
|
default_options = {
|
10
6
|
level: 1,
|
@@ -17,7 +13,7 @@ module Forester
|
|
17
13
|
|
18
14
|
options = default_options.merge(options)
|
19
15
|
|
20
|
-
|
16
|
+
aggregation_config = {
|
21
17
|
null_result: lambda { Hash.new },
|
22
18
|
initial_clusters: lambda { |tree| tree.nodes_of_level(options[:level]) },
|
23
19
|
map: lambda do |node|
|
@@ -35,7 +31,13 @@ module Forester
|
|
35
31
|
reduce_each: lambda { |acum, value| Array(acum).concat(Array(value)) },
|
36
32
|
reduce: lambda { |prev, group, result| prev.merge( { group => result } ) },
|
37
33
|
|
38
|
-
}
|
34
|
+
}
|
35
|
+
|
36
|
+
aggregated(aggregation_config, options)
|
37
|
+
end
|
38
|
+
|
39
|
+
def aggregated(config, options = {})
|
40
|
+
Enzymator::Aggregation.new(config).run_on(self, options)
|
39
41
|
end
|
40
42
|
|
41
43
|
end
|
data/lib/forester/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forester
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugenio Bruno
|
@@ -38,6 +38,48 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '11.2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '11.2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '5.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '5.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry-byebug
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.4'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.4'
|
41
83
|
description: Based on rubytree and enzymator, this gem lets you build trees and run
|
42
84
|
queries against them.
|
43
85
|
email: eugeniobruno@gmail.com
|
@@ -46,7 +88,7 @@ extensions: []
|
|
46
88
|
extra_rdoc_files: []
|
47
89
|
files:
|
48
90
|
- Gemfile
|
49
|
-
-
|
91
|
+
- LICENSE
|
50
92
|
- README.md
|
51
93
|
- Rakefile
|
52
94
|
- forester.gemspec
|
data/Gemfile.lock
DELETED
@@ -1,41 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
forester (0.0.1)
|
5
|
-
enzymator (~> 0.0)
|
6
|
-
rubytree (~> 0.9)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
byebug (9.0.5)
|
12
|
-
coderay (1.1.1)
|
13
|
-
enzymator (0.0.1)
|
14
|
-
json (1.8.3)
|
15
|
-
method_source (0.8.2)
|
16
|
-
minitest (5.9.0)
|
17
|
-
pry (0.10.4)
|
18
|
-
coderay (~> 1.1.0)
|
19
|
-
method_source (~> 0.8.1)
|
20
|
-
slop (~> 3.4)
|
21
|
-
pry-byebug (3.4.0)
|
22
|
-
byebug (~> 9.0)
|
23
|
-
pry (~> 0.10)
|
24
|
-
rake (11.2.2)
|
25
|
-
rubytree (0.9.7)
|
26
|
-
json (~> 1.8)
|
27
|
-
structured_warnings (~> 0.2)
|
28
|
-
slop (3.6.0)
|
29
|
-
structured_warnings (0.2.0)
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
ruby
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
forester!
|
36
|
-
minitest (~> 5.9)
|
37
|
-
pry-byebug
|
38
|
-
rake (~> 11.2)
|
39
|
-
|
40
|
-
BUNDLED WITH
|
41
|
-
1.12.5
|