[MacRuby-devel] [MacRuby] #309: String, Hash, Array: singleton attr_accessor cannot be defined

MacRuby ruby-noreply at macosforge.org
Wed Feb 10 22:04:33 PST 2010


#309: String, Hash, Array: singleton attr_accessor cannot be defined
------------------------+---------------------------------------------------
 Reporter:  dev@…       |        Owner:  lsansonetti@…        
     Type:  defect      |       Status:  closed               
 Priority:  minor       |    Milestone:  MacRuby 0.6          
Component:  MacRuby     |   Resolution:  fixed                
 Keywords:  singleton   |  
------------------------+---------------------------------------------------
Changes (by lsansonetti@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  MacRuby 0.5 => MacRuby 0.6


Comment:

 The snippet above does not print anything anymore in trunk (as of r3489).

 {{{
 $ cat t.rb
 [
   false,
   true,
   nil,
   1..100,
   /test/,
   Exception,
   Time,
   Hash,
   Array,
   String,
   Module,
   Object
 ].each do |k|
   s = k.is_a?(Class) ? k.new : k
   class << s
     attr_accessor :target1
     def target2
       :hit
     end
   end
   s.target1 = :hit
   def s.target3
     :hit
   end
   puts "#{k} err: singleton attr_accessor" unless s.target1 == :hit
   puts "#{k} err: singleton def (#2)" unless s.target2 == :hit
   puts "#{k} err: singleton def (#3)" unless s.target3 == :hit
 end

 $ ./miniruby  t.rb
 $
 }}}

 I guess we can close the bug.

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/309#comment:5>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list