I have an object created, and I want, based on some conditional check, to add some attributes to this object. How can I do this? To explain what I want:
A=O
class Person; end person = Person.new person.age # throws NoMethodError if true person.singleton_class.module_eval { attr_accessor :age } end person.age = 123 person.age #=> 123 person2 = Person.new person2.age #=> throws NoMethodError