attr_accessor with typecast feature.