Overriding initialize #1

Open
rstacruz opened this Issue Feb 8, 2012 · 0 comments

Projects

None yet

1 participant

@rstacruz
rstacruz commented Feb 8, 2012

Is there a way to subclass Hashr and provide your own initialize method? Perhaps to do validation like so:

class Config < Hashr
  def initialize(options)
    super options
    raise ConfigError, "output is not defined"  unless output?
  end
end

...or for whatever other reason the user would want to subclass Hashr. This example doesn't work properly right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment