Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Extend Class to include attr?

Reply
Thread Tools

Extend Class to include attr?

 
 
Mark T
Guest
Posts: n/a
 
      04-15-2010
Can I extend a class to add an attr_accessor?
So that getter & setter are created?

MarkT

 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      04-15-2010
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

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
extend class: include factories functions inside constructor aspineux Python 3 08-18-2011 03:09 PM
sending extend and include to your own class definition rlf Ruby 1 05-22-2009 09:01 PM
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
Extend the Membership Provider to include more user data =?Utf-8?B?Um9iIEtheQ==?= ASP .Net 5 01-06-2006 06:47 PM
#extend_object only for #extend and not #include Gavin Kistner Ruby 5 10-23-2004 10:03 AM



Advertisments