# \[dry-initializer\] Inherit from a Poro

**URL:** <https://discourse.dry-rb.org/t/dry-initializer-inherit-from-a-poro/1119>\
**Category:** Support\
**Created:** [August 26, 2020, 11:20am UTC](https://discourse.dry-rb.org/t/dry-initializer-inherit-from-a-poro/1119 "2020-08-26T11:20:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![systho](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/systho/32/139_2.png) [@systho](https://discourse.dry-rb.org/u/systho)\
**Post date:** [August 26, 2020, 11:20am UTC](https://discourse.dry-rb.org/t/dry-initializer-inherit-from-a-poro/1119/1 "2020-08-26T11:20:44Z")

</div>

Hello,

I very much like dry-initializer because it matches what I do in absolutely all of my constructors : get some data and dependencies and store them. do nothing else.

Therefore I’m trying to use it everywhere and there is one situation in which I have some difficulties : Inheriting from a superclass having a specific constructor signature.

Example :

```auto
class ParentFromExernalLib
  def initialize(family_name); ...; end
end

def Child < ParentFromExternalLib
  extend Dry::Initializer

  option :family_name
  option :first_name
  option :age
end

```

How can I call `super(family_name)` and also benefit from the initializer generated from dry-initializer

I was hoping to be able to do something like :

```auto
def initialize(*args)
  family_name = args.first
  super(family_name)
  class.dry_initializer.assign(self, *args)
end

```

Is there anything like this allowed using public - stable api ?

---

<div class="post-metadata">

**Author:** ![Crew](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.dry-rb.org/crew/32/693_2.png) [@Crew](https://discourse.dry-rb.org/u/Crew)\
**Post date:** [August 18, 2021, 2:04pm UTC](https://discourse.dry-rb.org/t/dry-initializer-inherit-from-a-poro/1119/2 "2021-08-18T14:04:54Z")

</div>

I would also like to know the good solution to this.

One (ugly) solution may be:

- create another wrapper class that would have ONLY injected args in constructor
- have a regular method in the wrapper that will return a new instance of your class forwarding the argument from the method

Example where we call the wrapper class ChildFactory:

```ruby
class ChildFactory
   extend Dry::Initializer
   
   option :family_name
   option :first_name
   option :age

   def build_instance(family_name)
        Child.new(family_name, first_name, age)
   end
end

class Child < ParentFromExternalLib
  def initialize(family_name:, first_name:, age:)
     ...
  end
end

```
