class Rectangle include Model attr_accessor :left, :right, :top, :bottom, :width def computed_width return unless left and right right - left end def effective_width width || computed_width end # ... etc ... def effective Rectangle.new( left: effective_left, right: effective_right, width: effective_width, # ... etc ) end end