You can't override initialize
, and what you have wouldnt work anyway (it would try to set a local variable called formula
in the initialize method). You can, however, move the conditions into your formula=
setter, so it reads like:
def formula=(restriction_type_name)
self[:formula] = RESTRICTION_TYPES[restriction_type_name]
end