Hey guys,
I wanted to be able to define a struct with an attribute that defaults on the value of another attribute within the same struct:
class Foo < Dry::Struct
attribute :requested_by_id, Types::String
attribute :executed_by_id, Types::String.optional.default(->(foo) { foo.requested_by_id })
end
Though default
does not seem to accept a block.
Any idea how to achieve this?