transproc 0.4.2 → 1.0.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +132 -2
- data/lib/transproc.rb +0 -71
- data/lib/transproc/array.rb +36 -74
- data/lib/transproc/class.rb +0 -4
- data/lib/transproc/coercions.rb +0 -4
- data/lib/transproc/composer.rb +0 -26
- data/lib/transproc/conditional.rb +0 -4
- data/lib/transproc/hash.rb +43 -159
- data/lib/transproc/proc.rb +0 -4
- data/lib/transproc/recursion.rb +0 -4
- data/lib/transproc/registry.rb +35 -1
- data/lib/transproc/store.rb +22 -1
- data/lib/transproc/transformer/class_interface.rb +63 -19
- data/lib/transproc/version.rb +1 -1
- data/spec/spec_helper.rb +0 -4
- data/spec/unit/array_transformations_spec.rb +18 -90
- data/spec/unit/function_not_found_error_spec.rb +1 -9
- data/spec/unit/function_spec.rb +17 -12
- data/spec/unit/hash_transformations_spec.rb +78 -240
- data/spec/unit/recursion_spec.rb +8 -24
- data/spec/unit/registry_spec.rb +80 -0
- data/spec/unit/store_spec.rb +35 -0
- data/spec/unit/transformer_spec.rb +205 -9
- data/spec/unit/transproc_spec.rb +2 -45
- metadata +2 -3
- data/lib/transproc/rspec.rb +0 -71
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: transproc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,7 +85,6 @@ files:
|
|
85
85
|
- lib/transproc/proc.rb
|
86
86
|
- lib/transproc/recursion.rb
|
87
87
|
- lib/transproc/registry.rb
|
88
|
-
- lib/transproc/rspec.rb
|
89
88
|
- lib/transproc/store.rb
|
90
89
|
- lib/transproc/support/deprecations.rb
|
91
90
|
- lib/transproc/transformer.rb
|
data/lib/transproc/rspec.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# ==============================================================================
|
4
|
-
# Examples for testing transproc functions
|
5
|
-
# ==============================================================================
|
6
|
-
|
7
|
-
shared_context :call_transproc do
|
8
|
-
let!(:__fn__) { described_class[*arguments] }
|
9
|
-
let!(:__initial__) do
|
10
|
-
begin
|
11
|
-
input.dup
|
12
|
-
rescue
|
13
|
-
input
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
subject { __fn__[input] }
|
18
|
-
end
|
19
|
-
|
20
|
-
shared_examples :transforming_data do
|
21
|
-
include_context :call_transproc
|
22
|
-
|
23
|
-
it '[returns the expected output]' do
|
24
|
-
expect(subject).to eql(output), <<-REPORT.gsub(%r{.+\|}, '')
|
25
|
-
|
|
26
|
-
|fn = #{described_class}#{Array[*arguments]}
|
27
|
-
|
|
28
|
-
|fn[#{input}]
|
29
|
-
|
|
30
|
-
| expected: #{output}
|
31
|
-
| got: #{subject}
|
32
|
-
REPORT
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
shared_examples :transforming_immutable_data do
|
37
|
-
include_context :call_transproc
|
38
|
-
|
39
|
-
it_behaves_like :transforming_data
|
40
|
-
|
41
|
-
it '[keeps input unchanged]' do
|
42
|
-
expect { subject }
|
43
|
-
.not_to change { input }, <<-REPORT.gsub(%r{.+\|}, '')
|
44
|
-
|
|
45
|
-
|fn = #{described_class}#{Array[*arguments]}
|
46
|
-
|
|
47
|
-
|expected: not to change #{__initial__}
|
48
|
-
| got: changed it to #{input}
|
49
|
-
REPORT
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
shared_examples :mutating_input_data do
|
54
|
-
include_context :call_transproc
|
55
|
-
|
56
|
-
it_behaves_like :transforming_data
|
57
|
-
|
58
|
-
it '[changes input]' do
|
59
|
-
expect { subject }
|
60
|
-
.to change { input }
|
61
|
-
.to(output), <<-REPORT.gsub(%r{.+\|}, '')
|
62
|
-
|
|
63
|
-
|fn = #{described_class}#{Array[*arguments]}
|
64
|
-
|
|
65
|
-
|fn[#{input}]
|
66
|
-
|
|
67
|
-
|expected: to change input to #{output}
|
68
|
-
| got: #{input}
|
69
|
-
REPORT
|
70
|
-
end
|
71
|
-
end
|