transform_tree 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/README.md +14 -3
- data/lib/transform_tree/transform_root.rb +1 -0
- data/lib/transform_tree/version.rb +1 -1
- metadata +1 -3
- data/.codeclimate.yml +0 -80
- data/.rubocop.yml +0 -3468
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea776e490e4f4da8fb6d171d3e06e6cc80a5d0e4
|
4
|
+
data.tar.gz: bc9a3252d87f93c9cb09e806369e4a66e29a44da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afbd58a98e1b4b8e53d5d326dcd3033f3733fd452faf13007b9167a4220e1579a415c9fe918a961c7c18e9a40205b87a22b366dd05fdb1dda409863a92eacad4
|
7
|
+
data.tar.gz: 57fc60710af2ad006d709b4bf93137e4a2b717443101523294154078fb258640e81339fc7fe975db1f3904161e3786e54a69b36ccbf2ce40241035d68e50d861
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@ TransformTree
|
|
2
2
|
---
|
3
3
|
[![Build Status](https://travis-ci.org/ffleming/transform_tree.svg?branch=master)](https://travis-ci.org/ffleming/transform_tree)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/ffleming/transform_tree/badges/gpa.svg)](https://codeclimate.com/github/ffleming/transform_tree)
|
5
|
-
[![
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/transform_tree.svg)](https://badge.fury.io/rb/transform_tree)
|
6
6
|
|
7
7
|
TransformTree provides an API for buildng trees of closures and executing those closures on provided input. This allows users to output all possible combinations of their desired transformations. A small library of useful transformations is included.
|
8
8
|
|
@@ -30,14 +30,25 @@ downcase = ->(o) { o.downcase }
|
|
30
30
|
append_s = ->(o) { "#{o}s" }
|
31
31
|
append_exc = ->(o) { "#{o}!" }
|
32
32
|
|
33
|
-
tree.add_transform(upcase, downcase, TransformTree::Transforms
|
34
|
-
tree.add_transform(append_s, append_exc, TransformTree::Transforms
|
33
|
+
tree.add_transform(upcase, downcase, TransformTree::Transforms::null)
|
34
|
+
tree.add_transform(append_s, append_exc, TransformTree::Transforms::null)
|
35
35
|
tree.execute('Woof')
|
36
36
|
```
|
37
37
|
```ruby
|
38
38
|
=> ["WOOFs", "WOOF!", "WOOF", "woofs", "woof!", "woof", "Woofs", "Woof!", "Woof"]
|
39
39
|
```
|
40
40
|
|
41
|
+
For full code examples, see integration specs in `/spec/integrations`.
|
42
|
+
|
43
|
+
### Provided transforms
|
44
|
+
The `TransformTree::Transforms` module provides some useful transformations. `ret` can be used to initially split your tree into distinct values, which are to be operated on later, e.g.
|
45
|
+
```ruby
|
46
|
+
closures = superlatives.map {|w| TransformTree::Transforms::ret(w)}
|
47
|
+
tree.add_transforms(*closures)
|
48
|
+
```
|
49
|
+
|
50
|
+
If you prefer, you can build the tree without using `Transforms::ret` and instead simply make multiple calls to `#execute`, passing an object to process each time.
|
51
|
+
|
41
52
|
## Development
|
42
53
|
|
43
54
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transform_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Forrest Fleming
|
@@ -76,10 +76,8 @@ executables: []
|
|
76
76
|
extensions: []
|
77
77
|
extra_rdoc_files: []
|
78
78
|
files:
|
79
|
-
- ".codeclimate.yml"
|
80
79
|
- ".gitignore"
|
81
80
|
- ".rspec"
|
82
|
-
- ".rubocop.yml"
|
83
81
|
- ".travis.yml"
|
84
82
|
- Gemfile
|
85
83
|
- LICENSE.txt
|
data/.codeclimate.yml
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
---
|
2
|
-
engines:
|
3
|
-
duplication:
|
4
|
-
enabled: true
|
5
|
-
config:
|
6
|
-
languages:
|
7
|
-
- ruby
|
8
|
-
- javascript
|
9
|
-
- python
|
10
|
-
- php
|
11
|
-
fixme:
|
12
|
-
enabled: true
|
13
|
-
rubocop:
|
14
|
-
enabled: true
|
15
|
-
ratings:
|
16
|
-
paths:
|
17
|
-
- "**.inc"
|
18
|
-
- "**.js"
|
19
|
-
- "**.jsx"
|
20
|
-
- "**.module"
|
21
|
-
- "**.php"
|
22
|
-
- "**.py"
|
23
|
-
- "**.rb"
|
24
|
-
exclude_paths:
|
25
|
-
- spec/
|
26
|
-
---
|
27
|
-
engines:
|
28
|
-
duplication:
|
29
|
-
enabled: true
|
30
|
-
config:
|
31
|
-
languages:
|
32
|
-
- ruby
|
33
|
-
- javascript
|
34
|
-
- python
|
35
|
-
- php
|
36
|
-
fixme:
|
37
|
-
enabled: true
|
38
|
-
rubocop:
|
39
|
-
enabled: true
|
40
|
-
ratings:
|
41
|
-
paths:
|
42
|
-
- "**.inc"
|
43
|
-
- "**.js"
|
44
|
-
- "**.jsx"
|
45
|
-
- "**.module"
|
46
|
-
- "**.php"
|
47
|
-
- "**.py"
|
48
|
-
- "**.rb"
|
49
|
-
exclude_paths:
|
50
|
-
- spec/
|
51
|
-
---
|
52
|
-
engines:
|
53
|
-
duplication:
|
54
|
-
enabled: true
|
55
|
-
config:
|
56
|
-
languages:
|
57
|
-
- ruby
|
58
|
-
fixme:
|
59
|
-
enabled: true
|
60
|
-
rubocop:
|
61
|
-
enabled: true
|
62
|
-
ratings:
|
63
|
-
paths:
|
64
|
-
- "**.rb"
|
65
|
-
exclude_paths:
|
66
|
-
- spec/
|
67
|
-
engines:
|
68
|
-
rubocop:
|
69
|
-
enabled: true
|
70
|
-
duplication:
|
71
|
-
enabled: true
|
72
|
-
config:
|
73
|
-
languages:
|
74
|
-
- ruby
|
75
|
-
ratings:
|
76
|
-
paths:
|
77
|
-
- lib/**
|
78
|
-
- "**.rb"
|
79
|
-
exclude_paths:
|
80
|
-
- spec/**/*
|