transproc 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd2c6ee5f665083297c1fcfd89a5e37d2284e498d6bc3953b88314e9513cbf43
4
- data.tar.gz: 6b9a5f270234b26b479095c66187f91fcca9428afb605f75aa9f51b890976eef
3
+ metadata.gz: c5e373dbeb3ba726459c3cf12238ba1e9fd096e308bdfcbf9799045653c053db
4
+ data.tar.gz: b761e23e9e7c630db6e08ee7e317758fe2bd53cb6a8a49bb7799902b657ffbc3
5
5
  SHA512:
6
- metadata.gz: 1c79034b27d317e52be52e98eb0cce057400efc99c05203e16fd39112a911d0bb568511d58dd138bbc32568cf8951fab586dcdf90e3c9bff434b6fd93347044b
7
- data.tar.gz: a2086dc6a92e03837412d7665869c1ad516a3a5ce097db1b31224936d767af048eadb32c86e8e0bcf815ef38445f9aed9a878b5f5ca97b5559b3194efa567aec
6
+ metadata.gz: 3aee819e93702794f280d6f5578670494fb28e3661f7c2bac311530363ac52aa83897cdc00ee2c591eadae86d3dcf4147805bfc9805f24dc6034314df2d8aacd
7
+ data.tar.gz: 55eb18ed05667309ee936ac75b6146940ca45c64cc215225a894e42b84ffddaea571d1a7675554cc8802f31b197dc2810886cdb0685c2473c9902e5c0aacf6bb
@@ -1,3 +1,11 @@
1
+ # v1.1.1 2019-12-21
2
+
3
+ ## Fixed
4
+
5
+ - Keyword warnings on Ruby 2.7 (flash-gordon)
6
+
7
+ [Compare v1.1.0...v1.1.1](https://github.com/solnic/transproc/compare/v1.1.0...v1.1.1)
8
+
1
9
  # v1.1.0 2019-07-18
2
10
 
3
11
  This is the last transproc release before the project will be forked to `dry-transformer`.
data/Gemfile CHANGED
@@ -14,3 +14,7 @@ group :tools do
14
14
  gem 'byebug', platform: :mri
15
15
  gem 'benchmark-ips'
16
16
  end
17
+
18
+ group :test do
19
+ gem 'warning' if defined? Warning
20
+ end
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
  [travis]: https://travis-ci.org/solnic/transproc
3
3
  [codeclimate]: https://codeclimate.com/github/solnic/transproc
4
4
  [coveralls]: https://coveralls.io/r/solnic/transproc
5
- [inchpages]: http://inch-ci.org/github/solnic/transproc
5
+ [inchpages]: https://inch-ci.org/github/solnic/transproc
6
6
 
7
7
  # Transproc
8
8
 
@@ -10,7 +10,7 @@
10
10
  [![Build Status](https://travis-ci.org/solnic/transproc.svg?branch=master)][travis]
11
11
  [![Code Climate](https://codeclimate.com/github/solnic/transproc/badges/gpa.svg)][codeclimate]
12
12
  [![Test Coverage](https://codeclimate.com/github/solnic/transproc/badges/coverage.svg)][codeclimate]
13
- [![Inline docs](http://inch-ci.org/github/solnic/transproc.svg?branch=master)][inchpages]
13
+ [![Inline docs](https://inch-ci.org/github/solnic/transproc.svg?branch=master)][inchpages]
14
14
 
15
15
  Transproc is a small library that allows you to compose procs into a functional pipeline using left-to-right function composition.
16
16
 
@@ -20,7 +20,7 @@ or `>>` in F#.
20
20
  `transproc` provides a mechanism to define and compose transformations,
21
21
  along with a number of built-in transformations.
22
22
 
23
- It's currently used as the data mapping backend in [Ruby Object Mapper](http://rom-rb.org).
23
+ It's currently used as the data mapping backend in [Ruby Object Mapper](https://rom-rb.org).
24
24
 
25
25
  ## Installation
26
26
 
@@ -51,7 +51,7 @@ It's easy to compose transformations:
51
51
 
52
52
  ```ruby
53
53
  to_string = Transproc::Function.new(:to_s.to_proc)
54
- (increment >> to_string)[1] => '2'
54
+ (increment >> to_string)[1] # => '2'
55
55
  ```
56
56
 
57
57
  It's easy to pass additional arguments to transformations:
@@ -92,13 +92,13 @@ M[:map_array, M[:to_string]].([1, 2, 3]) # => ['1', '2', '3']
92
92
  `transproc` comes with a lot of built-in functions. They come in the form of
93
93
  modules with class methods, which you can import into a registry:
94
94
 
95
- * [Coercions](http://www.rubydoc.info/gems/transproc/Transproc/Coercions)
96
- * [Array transformations](http://www.rubydoc.info/gems/transproc/Transproc/ArrayTransformations)
97
- * [Hash transformations](http://www.rubydoc.info/gems/transproc/Transproc/HashTransformations)
98
- * [Class transformations](http://www.rubydoc.info/gems/transproc/Transproc/ClassTransformations)
99
- * [Proc transformations](http://www.rubydoc.info/gems/transproc/Transproc/ProcTransformations)
100
- * [Conditional](http://www.rubydoc.info/gems/transproc/Transproc/Conditional)
101
- * [Recursion](http://www.rubydoc.info/gems/transproc/Transproc/Recursion)
95
+ * [Coercions](https://www.rubydoc.info/gems/transproc/Transproc/Coercions)
96
+ * [Array transformations](https://www.rubydoc.info/gems/transproc/Transproc/ArrayTransformations)
97
+ * [Hash transformations](https://www.rubydoc.info/gems/transproc/Transproc/HashTransformations)
98
+ * [Class transformations](https://www.rubydoc.info/gems/transproc/Transproc/ClassTransformations)
99
+ * [Proc transformations](https://www.rubydoc.info/gems/transproc/Transproc/ProcTransformations)
100
+ * [Conditional](https://www.rubydoc.info/gems/transproc/Transproc/Conditional)
101
+ * [Recursion](https://www.rubydoc.info/gems/transproc/Transproc/Recursion)
102
102
 
103
103
  You can import everything with:
104
104
 
@@ -235,7 +235,7 @@ transformation.call('[{"name":"Jane"}]')
235
235
 
236
236
  ## Credits
237
237
 
238
- This project is inspired by the work of following people:
238
+ This project is inspired by the work of the following people:
239
239
 
240
240
  * [Markus Schirp](https://github.com/mbj) and [morpher](https://github.com/mbj/morpher) project
241
241
  * [Josep M. Bach](https://github.com/txus) and [kleisli](https://github.com/txus/kleisli) project
@@ -19,6 +19,8 @@ module Transproc
19
19
  module HashTransformations
20
20
  extend Registry
21
21
 
22
+ EMPTY_HASH = {}.freeze
23
+
22
24
  if RUBY_VERSION >= '2.5'
23
25
  # Map all keys in a hash with the provided transformation function
24
26
  #
@@ -296,8 +298,9 @@ module Transproc
296
298
  # @return [Hash]
297
299
  #
298
300
  # @api public
299
- def self.unwrap(source_hash, root, selected = nil, prefix: false)
301
+ def self.unwrap(source_hash, root, selected = nil, options = EMPTY_HASH)
300
302
  return source_hash unless source_hash[root]
303
+ options, selected = selected, nil if options.empty? && selected.is_a?(::Hash)
301
304
 
302
305
  add_prefix = ->(key) do
303
306
  combined = [root, key].join('_')
@@ -308,7 +311,7 @@ module Transproc
308
311
  nested_hash = hash[root]
309
312
  keys = nested_hash.keys
310
313
  keys &= selected if selected
311
- new_keys = prefix ? keys.map(&add_prefix) : keys
314
+ new_keys = options[:prefix] ? keys.map(&add_prefix) : keys
312
315
 
313
316
  hash.update(Hash[new_keys.zip(keys.map { |key| nested_hash.delete(key) })])
314
317
  hash.delete(root) if nested_hash.empty?
@@ -77,11 +77,12 @@ module Transproc
77
77
  end
78
78
 
79
79
  # @api public
80
- def new(*args)
81
- super(*args).tap do |transformer|
80
+ def new(*)
81
+ super.tap do |transformer|
82
82
  transformer.instance_variable_set('@transproc', dsl.(transformer)) if dsl
83
83
  end
84
84
  end
85
+ ruby2_keywords(:new) if respond_to?(:ruby2_keywords, true)
85
86
 
86
87
  # Get a transformation from the container,
87
88
  # without adding it to the transformation pipeline
@@ -6,11 +6,12 @@ module Transproc
6
6
  # @api public
7
7
  module ClassInterface
8
8
  # @api public
9
- def new(*args)
10
- super(*args).tap do |transformer|
9
+ def new(*)
10
+ super.tap do |transformer|
11
11
  transformer.instance_variable_set('@transproc', transproc) if transformations.any?
12
12
  end
13
13
  end
14
+ ruby2_keywords(:new) if respond_to?(:ruby2_keywords, true)
14
15
 
15
16
  # @api private
16
17
  def inherited(subclass)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Transproc
4
- VERSION = '1.1.0'.freeze
4
+ VERSION = '1.1.1'.freeze
5
5
  end
@@ -13,6 +13,13 @@ if RUBY_ENGINE == 'ruby' && ENV['COVERAGE'] == 'true'
13
13
  end
14
14
  end
15
15
 
16
+ if defined? Warning
17
+ require 'warning'
18
+
19
+ Warning.ignore(/rspec/)
20
+ Warning.process { |w| raise RuntimeError, w } unless ENV['NO_WARNING']
21
+ end
22
+
16
23
  begin
17
24
  require 'byebug'
18
25
  rescue LoadError;end
@@ -39,7 +39,7 @@ describe Transproc::ClassTransformations do
39
39
  set_ivars = described_class.t(:set_ivars, klass)
40
40
 
41
41
  input = { name: 'Jane', age: 25 }
42
- output = klass.new(input)
42
+ output = klass.new(**input)
43
43
  result = set_ivars[input]
44
44
 
45
45
  expect(result).to eql(output)
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: 1.1.0
4
+ version: 1.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-07-18 00:00:00.000000000 Z
11
+ date: 2019-12-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Transform Ruby objects in functional style
14
14
  email:
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  - !ruby/object:Gem::Version
92
92
  version: '0'
93
93
  requirements: []
94
- rubygems_version: 3.0.3
94
+ rubygems_version: 3.0.6
95
95
  signing_key:
96
96
  specification_version: 4
97
97
  summary: Transform Ruby objects in functional style