a block which will be evaluated each time it is invoked (in case the value might depend on something else).  Additionally, it will work with boolean types. The Solution class Object def self.attribute(*arg,&block) (name, default) = arg short_name = name.to_s.sub(/\?/,"") self.send(:define_method, name) { if instance_variables.include? "@#{short_name}" self.instance_eval "@#{short_name}" else if block_given?