- Loosen
representable
dependency to< 4
.
- Remove
Forwardable
fromUnnest
and refrain from including it into theTwin
class. This may overwrite the same-namedActiveSupport::delegate
method and breaks things. Instead, do manual delegation and plan for 2023 to allow usingForwardable.delegate(target, what, where)
.
- Remove
**options
argument from#property
as it's inconsistent with underlying gems.
- Remove
uber
gem. - Remove
declarative-builder
dependency and make it optional. Addgem "declarative-builder"
to yourGemfile
should you need this feature.
- Upgrade
representable
to replaceDeclarative::Option
withRepresentable::Option
in order to support ruby-3 style of keyword arguments.
- Deprecation warning for nilify options for dry-v >= 1.x
- Fix initializer struct when using
false
as value
- Remove deprecation warnings for newer versions of dry-types
- Fix sqlite3 version to 1.3.x to avoid issue with AR 5.0
- Raise an error if class is used as property name
- Use Gem::Version to detect version for dry-types
- Add support for Dry::Types version 0.13
- Fix
NoMethodError: private method
property' called for MyForm:Class in Reform.by using
class_eval`.
Twin#schema
doesn'textend
at runtime anymore but uses a decorator foreach
.PropertyProcessor
now yields(twin, index)
if its working on a collection.
- Allow
false
as a:default
value. - Use
Declarative::Builder
instead ofUber::Builder
.
- In
#sync {}
with block,nil
values will now be included in the nested hash, resulting in a hash as follows.Note that in earlier versions,twin.sync do |nested_hash| nested_hash #=> { uuid: nil, title: "Greatest Hits" }
nil
values were not included in this hash.
- Rename
JSONB
toProperty::Hash
. - Fix
::unnest
so it copies delegated property options correctly. - Deprecate
Twin::Struct
.
- Introduce
Twin::JSONB
for easy access to hash fields usingStruct
.
- Use dry-types as a replacement for the deprecated virtus. You have to change to dry-types' constants.
- Add
:nilify
option to avoid processing blank strings.
- Manual accessors are no longer overridden when inheriting twin classes.
- The
:from
option is no longer ignored when inheriting.
- Fix loading order, you may now
require "disposable/twin"
without any further requires.
- Add
Twin::Parent
to access a nested's parent twin. - Introduce
Twin#build_for
andTwin#build_twin
. This is a private API change.
- Add
Collection#find_by
for easier traversal/querying of twin collections:album.songs.find_by(id: 1)
. - Fix inheritance of the
:default
option. This would formerly wrap the default value into anotherUber::Options::Value
. - Introduce
Struct#save!
.
- Use
Uber::Options::Value#call
to evaluate. - Add
Twin::Collection#append
.
- In
Callback::Group#call
, thecontext
option now allows running callbacks in different contexts. Per default, the group instance is context. - Callback handler methods now receive two options: the twin and the options hash passed into
Group#call
. This allows injecting arbitrary objects into callbacks, which is pretty awesome!
- Internally, use Declarative now for schema creation, resulting in the following internal changes.
Twin::representer_class.representable_attrs
is nowTwin::definitions
.
Disposable::Twin::Schema
is nowDisposable::Rescheme
. Renamed its:representer_from
option to:definitions_from
.twin: Twin::Song
is the only way to specify an external twin. To reduce complexity, I've removed the lambda version of:twin
.- Added
:exclude_properties
toRescheme
. - Runs with Representable 2.4 and 3.0.
- Restrict to Representable < 2.4.
- Allow to nil-out nested twins.
- Allow representable ~> 2.2.
- Added
Twin::for_collection
. Thanks to @timoschilling for the implementation.
:default
now accepts lambdas, too. Thanks to @johndagostino for implementing this.
- yanked.
- The
:twin
option is no longer evaluated at compile time, only inline twins are run through::process_inline!
. This allows specifying twin classes in lambdas for lazy-loading, and recursive twins.
- Specifying a nested twin with
:twin
instead of a block now gets identically processed to the block.
- Removed Setup#merge_options! and hash merge as this is already been done in #setup_properties.
- Every property now gets set on the twin, even if
readable: false
is set. :default
and:virtual
now work together.- Introduced
Setup#setup_property!
.
- Added
Default
.
- Correctly merge options from constructor into
@fields
. - Add
:virtual
which is an alias forreadable: false, writeable: false
. - Do not use getters with
SkipGetter
in#sync{}
.
- Add
Twin::Coercion
.
- Fix
Composition#save
, it now returns true only if all models could be saved. - Introduce
Callback::Group::clone
.
- Fix
Changed
which does not use the public reader to compare anymore, but the privatefield_read
.
- Adding
Setup::SkipSetter
andSync::SkipGetter
.
- This is the official first serious release.
- Rename
:as
to:from
. Deprecated, this will be removed in 0.1.0.
- Introduce the
Twin::Builder
module to easily allow creating a twin in a host object's constructor.
- Make disposable require representable 2.x.
- Add Twin::Option.
- Added
Composition#[]
to access contained models in favor of reader methods to models. The latter got removed. This allows mapping methods with the same name than the contained object.