Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.ruby > #3444

Re: Set attribute of superclass dynamically

From Brian Candler <b.candler@pobox.com>
Newsgroups comp.lang.ruby
Subject Re: Set attribute of superclass dynamically
Date 2011-04-24 14:50 -0500
Organization Service de news de lacave.net
Message-ID <fd613edf58283c237e6a1eca446ccb04@ruby-forum.com> (permalink)
References <ebce7d6a4bf3664dc0904383f9352c21@ruby-forum.com> <81c6dca0642a6bf7c2031f06c826817b@ruby-forum.com>

Show all headers | View raw


Jeroen v. wrote in post #994769:
> In the module you can do:
> self.send("#{method_name}=", value)
> This creates a setter on the fly for the superclass ;)

That *calls* the setter method, but only if it already exists. If it 
doesn't, it will raise an exception.

You need to provide some code to demonstrate what you're saying.

-- 
Posted via http://www.ruby-forum.com/.

Back to comp.lang.ruby | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Set attribute of superclass dinamically "Jeroen v." <jeroeningen@gmail.com> - 2011-04-24 09:29 -0500
  Re: Set attribute of superclass dynamically Brian Candler <b.candler@pobox.com> - 2011-04-24 11:00 -0500
  Re: Set attribute of superclass dynamically "Jeroen v." <jeroeningen@gmail.com> - 2011-04-24 12:13 -0500
    Re: Set attribute of superclass dynamically Brian Candler <b.candler@pobox.com> - 2011-04-24 14:50 -0500
  Re: Set attribute of superclass dinamically Josh Cheek <josh.cheek@gmail.com> - 2011-04-24 12:29 -0500

csiph-web