These are chat archives for dry-rb/chat

26th
Oct 2018
Kris Leech
@krisleech
Oct 26 2018 13:32
Is it not possible to override #initialize for dry-struct's. Unless I've got some typo it doesn't appear to be called:
  class Form < Dry::Struct
    attribute :name, Types::String

    def initialize(attrs = {})
      binding.pry # not called
      super.symbolize_keys
    end
  end
Okay I'm guessing transform_keys(&:to_sym) is the way to go.