- Keyword warnings on Ruby 2.7 (flash-gordon)
This is the last transproc release before the project will be forked to dry-transformer
.
- New DSL for defining transformers using
define!
method, which now supports instance methods as transformation functions (@solnic) - Simplified transformer class definition - registry is auto-configured and you can use
import
at the transformer class level (@solnic) - New
HashTransformation.deep_stringify_keys
function
- [BREAKING] Added minimal Ruby version to the gemspec file. Transproc now works with Ruby 2.3 and above (flash-gordon)
- Performance improvements introduced by using new built-in methods in
Hash
(v-kolesnikov + flash-gordon)
combine
works fine when there are missing nodes for deeply nested arrays (Kukunin)
combine
is now multiple times faster, depending on the level of nesting (Kukunin + splattael)nest
(thuswrap
too) is ~2x faster now (solnic)
- Add support of custom
Transproc::Registry
toTransproc::Transformer
(Kukunin) - Add
Transproc::Transformer.t
DSL method to access transformations (Kukunin) - Add
Transproc::Transformer.define
method for anonymous transprocs defining (Kukunin)
- Remove all mutating transformations (Kukunin)
- Remove deprecated
Transproc
global container withTransproc::Helper
(Kukunin) - Remove support of
Transproc::Transformer
without registry (Kukunin)
- prefix option to HashTransformations#unwrap and HashTransformations#unwrap! (AMHOL)
map_array
won't cause a SystemStackError in case of gigantic arrays (solnic)
- Class level transproc DSL (AMHOL)
- Works on latest rubinius again (katafrakt)
rename_keys
no longer creates new keys (robmiller)
MalformedInputError
exception. Transproc doesn't catch and re-raise exceptions any longer (nepalez)
- Functions now use
.call
rather than.[]
as it's more common (solnic)
Function#to_proc
properly carries additional args required by the proc (solnic)
:deep_merge
inHashTransformations
(saturnflyer)Transproc::Function#to_proc
method (nepalez)to_boolean
coercion turnsnil
intofalse
(c0)- Support symbolizing non-string values by
Coercions[:to_symbol]
andHashTransformations[:symbolize_keys]
(nepalez) - Support for importing several functions at once
import :foo, :bar, from: Foo
(nepalez)
This release deprecates a couple of APIs and changes the way functions can be
accessed. The global Transproc()
function registry is now deprecated and you
should define your own function registry via extend Transproc::Registry
and its
import
interface. See API docs for the details.
Proper deprecation warnings will appear as this is still a backward-compatible release, however, please update to the new API as the global registry will be gone in 1.0.0.
HashTransformations.eval_values
which evaluates callable values in a hash recursively (solnic)HashTransformations.deep_symbolize_keys
which, surprise surprise, symbolizes keys in a hash, recursively (solnic)- Shared examples
:transforming_immutable_data
and:mutating_input_data
to specify transformations in RSpec (nepalez)
Transproc::Registry
now uses singleton methods that can be imported from arbitrary modules viaimport
interface (nepalez)- Updated all built-in modules to the new registry API (nepalez + solnic)
Transproc()
has been deprecated (solnic)Transproc::Helper
has been deprecated (solnic)
Transproc::Registry
extension for registering reusable functions within modules (nepalez):recursion
recurse over an enumerable (AMHOL)
:group
,:nest
, and:wrap
support adding new data to existing groups/wraps (nepalez)Transproc::MalformedInputError
includes original backtrace now (solnic)
:split
splits a hash to array by a list of values from a specified key of the hash (nepalez):ungroup
is an inverse array transormation with respect to the:group
(nepalez):insert_key
(and:insert_key!
) is the partial inversion of:extract_key
. The method converts array of values into array of tuples with given key (nepalez):add_keys
(and:add_keys!
) adds missing keys to all tuples in array (nepalez)
- Warning about circular requires is gone now (splattael)
:fold
folds array of tuples into array of values from a specified key of the hash (nepalez)
- Fixed some Rubocop warnings (nepalez)
- Changed Rubocop
RegexpLiteral
fromMaxSlashes: 0
(not supported) toEnforcedStyle: percent_r
(nepalez)
:constructor_inject
injects arguments into the constructor of a class (AMHOL):set_ivars
which allocates an object and sets instance variables from a hash (key/value pairs) on an object (AMHOL):combine
which merges multiple arrays into one using "join keys" (solnic):reject_keys
which rejects specified keys in a hash (solnic):accept_keys
which accepts specified keys in a hash (solnic):extract_key
converts the array of hashes to array of values (nepalez)
:unwrap
can be called without keys (solnic)Transproc.register
raises a meaningful error when a given function is already registered (kwando)Transproc[]
raises a meaningful error when a given function doesn't exist (kwando)Transproc[]
raises a meaningful error when a transformation crashes (kwando)
Transproc()
no longer creates a function if it's already a function (splattael)- A couple of mistakes in the API docs (AMHOL)
- Rubocop integration \o/ (AMHOL)
:map_keys
hash transformation (AMHOL):stringify_keys
hash transformation (AMHOL):map_values
hash transformation (AMHOL):guard
function (AMHOL):is
type-check function (solnic)Function#to_ast
for easy inspection (solnic)- Ability to define module with custom functions that will be auto-registered (solnic + splattael)
- [BREAKING]
map_hash
renamed torename_keys
- [BREAKING]
map_key
renamed tomap_value
- [BREAKING]
map_array
no longer accepts multiple functions (AMHOL) - All functions are now defined as module functions (solnic + splattael)
- Functions no longer create anonymous procs (solnic)
- Added
hash_recursion
andarray_recursion
functions (AMHOL) - Added
unwrap
andunwrap!
functions (aflatter)
- Speedup transproc
group
(splattael)
:nest
creates an empty hash even when keys are not present
Transproc(:map_array)
performance improvements (splattael + solnic)- hash transformation performance improvements (solnic)
Transproc(:nest)
handles falsy values correctly now (solnic)- Missing
require "time"
added (splattael)
- added bang-method equivalents to all functions (solnic)
- group and wrap array transformations (solnic)
- date, datetime and time coercions (solnic)
- numeric coercions (solnic)
- boolean coercions (solnic)
- [hash]
:nest
which wraps a set of keys under a new key (solnic)
First public release \o/