Extend Class to include attr?

Can I extend a class to add an attr_accessor?
So that getter & setter are created?

MarkT

On 15.04.2010 05:30, Mark T wrote:

Can I extend a class to add an attr_accessor?
So that getter& setter are created?

Yes.

How?

class AnyClass
attr_accessor :foo
end

Kind regards

robert

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs