Ticket #549 (closed defect: fixed)
Class variables are not initialised properly.
| Reported by: | sorin.ionescu@… | Owned by: | lsansonetti@… |
|---|---|---|---|
| Priority: | blocker | Milestone: | MacRuby 0.7 |
| Component: | MacRuby | Keywords: | class, instance |
| Cc: |
Description (last modified by martinlagardette@…) (diff)
The mime-types gem has a class and an instance interface. The class interface uses an instance of itself. However, it doesn’t work in MacRuby. It does not seem to be initialised properly. I have included in a sample code with the expected behaviour. Changing @__types__ to @@__types__ will not fix it.
class MacRubyInitTest
def initialize
@foo = true
end
def add
p self
puts "@foo = " + @foo.inspect
end
@__types__ = self.new()
def self.add
@__types__.add
end
end
t = MacRubyInitTest.new
t.add
MacRubyInitTest.add
Output (MacRuby 0.5)
<MacRubyInitTest:0x200024d80 @foo=true> @foo = true <MacRubyInitTest:0x200024e00 @foo=true> @foo = nil
Expected (Ruby 1.9.1/1.8.7)
#<MacRubyInitTest:0x00000100847920 @foo=true> @foo = true #<MacRubyInitTest:0x00000100847a70 @foo=true> @foo = true
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


