| |
comp.lang.ruby |
> I'd like to be able to do the following: > class Method; attr_accessor :foo; end > method(:bar).foo #= 1 > Of coures what i'd actually get is: > because method(:bar) returns a new object each time. > Is it possible to bind properties to a method definition? If so, how? -- "Programs must be written for people to read, and only incidentally
> Hi,
> def bar; "some_res"; end
> method(:bar).foo=1
> method(:bar).foo #= nil
message 'foo=' ?
James Britt
for machines to execute."
- H. Abelson and G. Sussman
(in "The Structure and Interpretation of Computer Programs)