From: Gioele Barabucci Date: 2005-08-04T08:56:05+09:00 Subject: strange: 'super' is not the parent class When I try to run the attached code (ar2.rb) with ruby 1.8.2 I get the following error: ../ar2.rb:41:in `packDecl': undefined method `packDecl' for "\000\000\000\005\000\000\000\002":String (NoMethodError) from ./ar2.rb:27:in `pack' from ./ar2.rb:54 from ./ar2.rb:49:in `each' from ./ar2.rb:49 It seems like "\0\0\0\5\0\0\0\2".packDecl is called instead of super.packDecl. Did I overwrite 'super'? Where? #!/usr/bin/env ruby require 'pp' BASE_INFO = 0x2 class StreamData attr_accessor :typeDataLength attr_accessor :type attr_accessor :payloadLength def initialize @typeDataLength = 0 @payloadLength = 0 end def packDecl length = @typeDataLength + @payloadLength return [length, @type].pack("LI") end def packTypeData return Array.new end def pack return packDecl + packTypeData end end class BaseInfoData < StreamData attr_accessor :name def initialize super @type = BASE_INFO end def packDecl @typeDataLength = [@name].pack("a*").length return super.packDecl end def packTypeData return [@name].pack("a*") end end ["happy", "two"].each { |file| baseInfo = BaseInfoData.new() baseInfo.name = file pp baseInfo.pack } -- Gioele Barabucci ) http://cs.unibo.it/~barabucc