transform_tree 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 384deea69c93838c12f9651835d96197fc7d5709
4
- data.tar.gz: fe884e032e63970cc78b8764339f4990a385968b
3
+ metadata.gz: ea776e490e4f4da8fb6d171d3e06e6cc80a5d0e4
4
+ data.tar.gz: bc9a3252d87f93c9cb09e806369e4a66e29a44da
5
5
  SHA512:
6
- metadata.gz: e23bccfb24fbb878bfe90157984c29a867bdb1470d780b2e9da0b234043feed33374667a26a34e842ffa9729cfc2d76fed303bd9fbc29d7a06d622cfe819a4ec
7
- data.tar.gz: adf342ab35721cd433fe4f4ff3cf163ea70bfedbf6ea55fd41a1b567bfd661a51714904706ba68d1306699b9c5c9de8f5e14ed872c51cdb2521d1bc940131caf
6
+ metadata.gz: afbd58a98e1b4b8e53d5d326dcd3033f3733fd452faf13007b9167a4220e1579a415c9fe918a961c7c18e9a40205b87a22b366dd05fdb1dda409863a92eacad4
7
+ data.tar.gz: 57fc60710af2ad006d709b4bf93137e4a2b717443101523294154078fb258640e81339fc7fe975db1f3904161e3786e54a69b36ccbf2ce40241035d68e50d861
data/Gemfile CHANGED
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in transform_tree.gemspec
4
- gem "codeclimate-test-reporter", group: :test, require: nil
5
3
  gemspec
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
- [![Test Coverage](https://codeclimate.com/github/ffleming/transform_tree/badges/coverage.svg)](https://codeclimate.com/github/ffleming/transform_tree/coverage)
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.null)
34
- tree.add_transform(append_s, append_exc, TransformTree::Transforms.null)
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.
@@ -16,6 +16,7 @@ module TransformTree
16
16
  end
17
17
 
18
18
  def execute(*args)
19
+ args = [nil] if args.empty?
19
20
  super(*args)
20
21
  end
21
22
 
@@ -1,3 +1,3 @@
1
1
  module TransformTree
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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/**/*