solnic/virtus — pull request #181 by marten (2013-07-14 20:17:46+00:00)
Title: Call super's initializer

If Virtus is included in a module, that module might want to add additional initialization, but without a call to super it can't.

It might be I added tests in the wrong places. If that or anything else is wrong, please let me know.

### Example use case:

```ruby
module OurGem
include Virtus
def initialize(*args)
perform_authorization_check
end
end
```

### Caveats

I'm not too happy about explicitly expecting that no arguments are expected for `super`. However, if Virtus is included in a simple class with no (explicit) ancestor the ancestor will be Object, whose `#initialize` takes no arguments. So without the parentheses after `super()` the most basic use case would fail. This does however mean that the user still can't have:

``ruby
class Supr
def initialize(attributes = {})
# do stuff with the initial attributes hash
end
end

class Child
include Virtus
end
```

I don't know if it's worth muddying up the code with arity checks. If there's an elegant solution, I'd love to hear it.