« Return to Thread: simple way to encapsulate class << self ; attr_accessor :xyz ; end?

Re: simple way to encapsulate class << self ; attr_accessor :xyz ; end?

by Giles Bowkett :: Rate this Message:

Reply to Author | View in Thread

>   module Kernel
>     def meta
>       class << self; self; end
>     end
>   end
>
>   class Module
>     public :attr_accessor, :attr_reader, :attr_writer
>   end
>
> then
>
>   def foo
>     meta.attr_accessor :x
>   end

Out of several excellent alternatives to my code I think this is the
most compelling.

--
Giles Bowkett

Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com/

 « Return to Thread: simple way to encapsulate class << self ; attr_accessor :xyz ; end?