dry-transformer 0.1.0 → 0.1.1

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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/LICENSE +1 -1
  4. data/README.md +1 -1
  5. data/dry-transformer.gemspec +17 -10
  6. data/lib/dry/transformer/hash.rb +2 -1
  7. data/lib/dry/transformer/version.rb +1 -1
  8. metadata +10 -56
  9. data/.codeclimate.yml +0 -12
  10. data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
  11. data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
  12. data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
  13. data/.github/workflows/custom_ci.yml +0 -66
  14. data/.github/workflows/docsite.yml +0 -34
  15. data/.github/workflows/sync_configs.yml +0 -34
  16. data/.gitignore +0 -16
  17. data/.rspec +0 -4
  18. data/.rubocop.yml +0 -95
  19. data/CODE_OF_CONDUCT.md +0 -13
  20. data/CONTRIBUTING.md +0 -29
  21. data/Gemfile +0 -19
  22. data/Rakefile +0 -6
  23. data/docsite/source/built-in-transformations.html.md +0 -47
  24. data/docsite/source/index.html.md +0 -15
  25. data/docsite/source/transformation-objects.html.md +0 -32
  26. data/docsite/source/using-standalone-functions.html.md +0 -82
  27. data/spec/spec_helper.rb +0 -31
  28. data/spec/unit/array/combine_spec.rb +0 -224
  29. data/spec/unit/array_transformations_spec.rb +0 -233
  30. data/spec/unit/class_transformations_spec.rb +0 -50
  31. data/spec/unit/coercions_spec.rb +0 -132
  32. data/spec/unit/conditional_spec.rb +0 -48
  33. data/spec/unit/function_not_found_error_spec.rb +0 -12
  34. data/spec/unit/function_spec.rb +0 -193
  35. data/spec/unit/hash_transformations_spec.rb +0 -490
  36. data/spec/unit/proc_transformations_spec.rb +0 -20
  37. data/spec/unit/recursion_spec.rb +0 -145
  38. data/spec/unit/registry_spec.rb +0 -202
  39. data/spec/unit/store_spec.rb +0 -198
  40. data/spec/unit/transformer/class_interface_spec.rb +0 -350
  41. data/spec/unit/transformer/dsl_spec.rb +0 -15
  42. data/spec/unit/transformer/instance_methods_spec.rb +0 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b479f91512fd97581875e395c171f70031cd6316e7e546f634285a4db46c183
4
- data.tar.gz: b6b5dcc266532598a8b656d5a0597809ea90de917b2f624e95886ddadfa1b378
3
+ metadata.gz: '07286bcabed176ae3f17868f5e838decc2ba0c192828b6e69da92ec18f8713e0'
4
+ data.tar.gz: 3c5b577d2fc463182fd9fb28a333b594622c4afa61b276183f3247ce757c55e8
5
5
  SHA512:
6
- metadata.gz: 1e97fff09478334ab2117f61c5133cc2ab9ea11f53ab465dbe766f6b8239e10dc9e7b030b52a33ecd368b57aac71f5b8cb6f05b0e9726e38a705d759696f98c0
7
- data.tar.gz: 46927ebbf2cc102a4527a0369e6675613301f78f4be6838bc981667b464e515878a8f3fcf470229fb32d8ff3b8cf00dd903cbf3ed20aa35b6cdc0881afe70999
6
+ metadata.gz: e100d0e8782d778c4abf0c6f805bfbcafd1d86ce5876a898706114fa658ed3c3045345470adc6bd44a750b995a92d0033d95fadbe0e565bca5fccd52d7b4a993
7
+ data.tar.gz: 41ea28575f7d9691f8e36e14920b4a65718738086a96ebc5b73cee2f3108d8884a99f6da0b933c17b1cf270a314a93fbb39c4b30eb4c51cc0736d690b22be662
@@ -1,3 +1,11 @@
1
+ # 2020-01-14
2
+
3
+ ## Fixed
4
+
5
+ Fixed Dry::Transformer::HashTransformations.unwrap when hash contains root key (@AMHOL)
6
+
7
+ [Compare v0.1.0...v0.1.1](https://github.com/dry-rb/dry-transaction/compare/v0.1.0...v0.1.1)
8
+
1
9
  # v0.1.0 2019-12-28
2
10
 
3
11
  Initial port of the [transproc](https://github.com/solnic/transproc) gem.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2015-2019 dry-rb team
3
+ Copyright (c) 2015-2020 dry-rb team
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  ## Supported Ruby versions
21
21
 
22
- This library officially supports following Ruby versions:
22
+ This library officially supports the following Ruby versions:
23
23
 
24
24
  * MRI >= `2.4`
25
25
  * jruby >= `9.2`
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ # this file is managed by dry-rb/devtools project
2
3
 
3
4
  lib = File.expand_path('lib', __dir__)
4
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
@@ -6,17 +7,23 @@ require 'dry/transformer/version'
6
7
 
7
8
  Gem::Specification.new do |spec|
8
9
  spec.name = 'dry-transformer'
9
- spec.version = Dry::Transformer::VERSION.dup
10
- spec.authors = ['Piotr Solnica']
11
- spec.email = ['piotr.solnica@gmail.com']
12
- spec.summary = 'Data transformation toolkit'
13
- spec.description = spec.summary
14
- spec.homepage = 'https://dry-rb.org/gems/dry-transformer/'
10
+ spec.authors = ["Piotr Solnica"]
11
+ spec.email = ["piotr.solnica@gmail.com"]
15
12
  spec.license = 'MIT'
13
+ spec.version = Dry::Transformer::VERSION.dup
16
14
 
17
- spec.files = `git ls-files -z`.split("\x0")
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
15
+ spec.summary = "Data transformation toolkit"
16
+ spec.description = spec.summary
17
+ spec.homepage = 'https://dry-rb.org/gems/dry-transformer'
18
+ spec.files = Dir['CHANGELOG.md', 'LICENSE', 'README.md', 'dry-transformer.gemspec', 'lib/**/*']
20
19
  spec.require_paths = ['lib']
21
- spec.required_ruby_version = '>= 2.3.0'
20
+
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
22
+ spec.metadata['changelog_uri'] = 'https://github.com/dry-rb/dry-transformer/blob/master/CHANGELOG.md'
23
+ spec.metadata['source_code_uri'] = 'https://github.com/dry-rb/dry-transformer'
24
+ spec.metadata['bug_tracker_uri'] = 'https://github.com/dry-rb/dry-transformer/issues'
25
+
26
+ spec.required_ruby_version = '>= 2.4.0'
27
+
28
+ # to update dependencies edit project.yml
22
29
  end
@@ -310,9 +310,10 @@ module Dry
310
310
  keys = nested_hash.keys
311
311
  keys &= selected if selected
312
312
  new_keys = prefix ? keys.map(&add_prefix) : keys
313
+ nested_contains_root_key = nested_hash.key?(root)
313
314
 
314
315
  hash.update(Hash[new_keys.zip(keys.map { |key| nested_hash.delete(key) })])
315
- hash.delete(root) if nested_hash.empty?
316
+ hash.delete(root) if nested_hash.empty? && !nested_contains_root_key
316
317
  end
317
318
  end
318
319
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Dry
4
4
  module Transformer
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-transformer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Solnica
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-28 00:00:00.000000000 Z
11
+ date: 2020-01-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Data transformation toolkit
14
14
  email:
@@ -17,27 +17,9 @@ executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
- - ".codeclimate.yml"
21
- - ".github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md"
22
- - ".github/ISSUE_TEMPLATE/---bug-report.md"
23
- - ".github/ISSUE_TEMPLATE/---feature-request.md"
24
- - ".github/workflows/custom_ci.yml"
25
- - ".github/workflows/docsite.yml"
26
- - ".github/workflows/sync_configs.yml"
27
- - ".gitignore"
28
- - ".rspec"
29
- - ".rubocop.yml"
30
20
  - CHANGELOG.md
31
- - CODE_OF_CONDUCT.md
32
- - CONTRIBUTING.md
33
- - Gemfile
34
21
  - LICENSE
35
22
  - README.md
36
- - Rakefile
37
- - docsite/source/built-in-transformations.html.md
38
- - docsite/source/index.html.md
39
- - docsite/source/transformation-objects.html.md
40
- - docsite/source/using-standalone-functions.html.md
41
23
  - dry-transformer.gemspec
42
24
  - lib/dry-transformer.rb
43
25
  - lib/dry/transformer.rb
@@ -61,26 +43,14 @@ files:
61
43
  - lib/dry/transformer/registry.rb
62
44
  - lib/dry/transformer/store.rb
63
45
  - lib/dry/transformer/version.rb
64
- - spec/spec_helper.rb
65
- - spec/unit/array/combine_spec.rb
66
- - spec/unit/array_transformations_spec.rb
67
- - spec/unit/class_transformations_spec.rb
68
- - spec/unit/coercions_spec.rb
69
- - spec/unit/conditional_spec.rb
70
- - spec/unit/function_not_found_error_spec.rb
71
- - spec/unit/function_spec.rb
72
- - spec/unit/hash_transformations_spec.rb
73
- - spec/unit/proc_transformations_spec.rb
74
- - spec/unit/recursion_spec.rb
75
- - spec/unit/registry_spec.rb
76
- - spec/unit/store_spec.rb
77
- - spec/unit/transformer/class_interface_spec.rb
78
- - spec/unit/transformer/dsl_spec.rb
79
- - spec/unit/transformer/instance_methods_spec.rb
80
- homepage: https://dry-rb.org/gems/dry-transformer/
46
+ homepage: https://dry-rb.org/gems/dry-transformer
81
47
  licenses:
82
48
  - MIT
83
- metadata: {}
49
+ metadata:
50
+ allowed_push_host: https://rubygems.org
51
+ changelog_uri: https://github.com/dry-rb/dry-transformer/blob/master/CHANGELOG.md
52
+ source_code_uri: https://github.com/dry-rb/dry-transformer
53
+ bug_tracker_uri: https://github.com/dry-rb/dry-transformer/issues
84
54
  post_install_message:
85
55
  rdoc_options: []
86
56
  require_paths:
@@ -89,7 +59,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
59
  requirements:
90
60
  - - ">="
91
61
  - !ruby/object:Gem::Version
92
- version: 2.3.0
62
+ version: 2.4.0
93
63
  required_rubygems_version: !ruby/object:Gem::Requirement
94
64
  requirements:
95
65
  - - ">="
@@ -100,20 +70,4 @@ rubygems_version: 3.0.3
100
70
  signing_key:
101
71
  specification_version: 4
102
72
  summary: Data transformation toolkit
103
- test_files:
104
- - spec/spec_helper.rb
105
- - spec/unit/array/combine_spec.rb
106
- - spec/unit/array_transformations_spec.rb
107
- - spec/unit/class_transformations_spec.rb
108
- - spec/unit/coercions_spec.rb
109
- - spec/unit/conditional_spec.rb
110
- - spec/unit/function_not_found_error_spec.rb
111
- - spec/unit/function_spec.rb
112
- - spec/unit/hash_transformations_spec.rb
113
- - spec/unit/proc_transformations_spec.rb
114
- - spec/unit/recursion_spec.rb
115
- - spec/unit/registry_spec.rb
116
- - spec/unit/store_spec.rb
117
- - spec/unit/transformer/class_interface_spec.rb
118
- - spec/unit/transformer/dsl_spec.rb
119
- - spec/unit/transformer/instance_methods_spec.rb
73
+ test_files: []
@@ -1,12 +0,0 @@
1
- # this file is managed by dry-rb/devtools project
2
-
3
- version: "2"
4
-
5
- exclude_patterns:
6
- - "benchmarks/"
7
- - "examples/"
8
- - "spec/"
9
-
10
- plugins:
11
- rubocop:
12
- enabled: true
@@ -1,10 +0,0 @@
1
- ---
2
- name: "⚠️ Please don't ask for support via issues"
3
- about: See CONTRIBUTING.md for more information
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
-
@@ -1,30 +0,0 @@
1
- ---
2
- name: "\U0001F41B Bug report"
3
- about: See CONTRIBUTING.md for more information
4
- title: ''
5
- labels: bug
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Before you submit this: WE ONLY ACCEPT BUG REPORTS AND FEATURE REQUESTS**
11
-
12
- For more information see `CONTRIBUTING.md`.
13
-
14
- **Describe the bug**
15
-
16
- A clear and concise description of what the bug is.
17
-
18
- **To Reproduce**
19
-
20
- Provide detailed steps to reproduce, an executable script would be best.
21
-
22
- **Expected behavior**
23
-
24
- A clear and concise description of what you expected to happen.
25
-
26
- **Your environment**
27
-
28
- - Affects my production application: **YES/NO**
29
- - Ruby version: ...
30
- - OS: ...
@@ -1,18 +0,0 @@
1
- ---
2
- name: "\U0001F6E0 Feature request"
3
- about: See CONTRIBUTING.md for more information
4
- title: ''
5
- labels: feature
6
- assignees: ''
7
-
8
- ---
9
-
10
- Summary of what the feature is supposed to do.
11
-
12
- ## Examples
13
-
14
- Code examples showing how the feature could be used.
15
-
16
- ## Resources
17
-
18
- Additional information, like a link to the discussion forum thread where the feature was discussed etc.
@@ -1,66 +0,0 @@
1
- # this file is managed by dry-rb/devtools project
2
-
3
- name: ci
4
-
5
- on:
6
- push:
7
- paths:
8
- - .github/workflows/custom_ci.yml
9
- - lib/**
10
- - spec/**
11
- - Gemfile
12
- - "*.gemspec"
13
-
14
- jobs:
15
- tests-mri:
16
- runs-on: ubuntu-latest
17
- strategy:
18
- fail-fast: false
19
- matrix:
20
- ruby: ["2.6.x", "2.5.x", "2.4.x"]
21
- include:
22
- - ruby: "2.6.x"
23
- coverage: "true"
24
- steps:
25
- - uses: actions/checkout@v1
26
- - name: Set up Ruby
27
- uses: actions/setup-ruby@v1
28
- with:
29
- ruby-version: ${{matrix.ruby}}
30
- - name: Download test reporter
31
- if: "matrix.coverage == 'true'"
32
- run: |
33
- mkdir -p tmp/
34
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./tmp/cc-test-reporter
35
- chmod +x ./tmp/cc-test-reporter
36
- ./tmp/cc-test-reporter before-build
37
- - name: Bundle install
38
- run: |
39
- gem install bundler
40
- bundle install --jobs 4 --retry 3 --without tools docs benchmarks
41
- - name: Run all tests
42
- env:
43
- COVERAGE: ${{matrix.coverage}}
44
- CODACY_PROJECT_TOKEN: ${{secrets.CODACY_PROJECT_TOKEN}}
45
- CODACY_RUN_LOCAL: true
46
- run: bundle exec rake
47
- tests-others:
48
- runs-on: ubuntu-latest
49
- strategy:
50
- fail-fast: false
51
- matrix:
52
- image: ["jruby:9.2.8", "ruby:rc"]
53
- container:
54
- image: ${{matrix.image}}
55
- steps:
56
- - uses: actions/checkout@v1
57
- - name: Install git
58
- run: |
59
- apt-get update
60
- apt-get install -y --no-install-recommends git
61
- - name: Bundle install
62
- run: |
63
- gem install bundler
64
- bundle install --jobs 4 --retry 3 --without tools docs benchmarks
65
- - name: Run all tests
66
- run: bundle exec rake
@@ -1,34 +0,0 @@
1
- # this file is managed by dry-rb/devtools project
2
-
3
- name: docsite
4
-
5
- on:
6
- push:
7
- paths:
8
- - docsite/**
9
- - .github/workflows/docsite.yml
10
- branches:
11
- - master
12
- - release-**
13
- tags:
14
-
15
- jobs:
16
- update-docs:
17
- runs-on: ubuntu-latest
18
- steps:
19
- - uses: actions/checkout@v1
20
- - name: Set up Ruby
21
- uses: actions/setup-ruby@v1
22
- with:
23
- ruby-version: "2.6.x"
24
- - name: Install dependencies
25
- run: |
26
- gem install bundler
27
- bundle install --jobs 4 --retry 3 --without benchmarks sql
28
- - name: Symlink ossy
29
- run: mkdir -p bin && ln -sf "$(bundle show ossy)/bin/ossy" bin/ossy
30
- - name: Trigger dry-rb.org deploy
31
- env:
32
- GITHUB_LOGIN: dry-bot
33
- GITHUB_TOKEN: ${{ secrets.GH_PAT }}
34
- run: bin/ossy github workflow dry-rb/dry-rb.org ci
@@ -1,34 +0,0 @@
1
- # this file is managed by dry-rb/devtools project
2
-
3
- name: sync_configs
4
-
5
- on:
6
- repository_dispatch:
7
-
8
- jobs:
9
- sync-configs:
10
- runs-on: ubuntu-latest
11
- if: github.event.action == 'sync_configs'
12
- steps:
13
- - uses: actions/checkout@v1
14
- - name: Update configuration files from devtools
15
- env:
16
- GITHUB_LOGIN: dry-bot
17
- GITHUB_TOKEN: ${{ secrets.GH_PAT }}
18
- run: |
19
- git clone https://github.com/dry-rb/devtools.git tmp/devtools
20
-
21
- if [ -f ".github/workflows/custom_ci.yml" ]; then
22
- rsync -av --exclude '.github/workflows/ci.yml' tmp/devtools/shared/ . ;
23
- else
24
- rsync -av tmp/devtools/shared/ . ;
25
- fi
26
-
27
- git config --local user.email "dry-bot@dry-rb.org"
28
- git config --local user.name "dry-bot"
29
- git add -A
30
- git commit -m "[devtools] config sync" || echo "nothing changed"
31
- - name: Push changes
32
- uses: ad-m/github-push-action@master
33
- with:
34
- github_token: ${{ secrets.GH_PAT }}
data/.gitignore DELETED
@@ -1,16 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /vendor/
5
- /_yardoc/
6
- /coverage/
7
- /doc/
8
- /pkg/
9
- /spec/reports/
10
- /tmp/
11
- *.bundle
12
- *.so
13
- *.o
14
- *.a
15
- mkmf.log
16
-
data/.rspec DELETED
@@ -1,4 +0,0 @@
1
- --color
2
- --require spec_helper
3
- --order random
4
-