Z
Zakaria
Hi,
Currently I got many simple class which is just a simple record-like.
An example
-----------------------------------
class LoopTag # :nodoc:
attr_reader aram
attr_reader :contents
def initialize(param)
@param, @contents = param, []
end
def ==(other)
return false unless other.class == self.class
return other.param == @param && other.contents == @contents
end
end
------------------------------------
and I got a couple more class like this.
Is there a way to make a generic #== or some Module that I can include ?
I surely need it to do assert_equal on unit test.
You know, I just waste a couple hour tracking bug that doesn't exists
because I forgot to implement #==
TIA,
-- Zakaria
(e-mail address removed) Yahoo!: z4k4ri4
http://zakaria.is-a-geek.org
http://pemula.linux.or.id
Currently I got many simple class which is just a simple record-like.
An example
-----------------------------------
class LoopTag # :nodoc:
attr_reader aram
attr_reader :contents
def initialize(param)
@param, @contents = param, []
end
def ==(other)
return false unless other.class == self.class
return other.param == @param && other.contents == @contents
end
end
------------------------------------
and I got a couple more class like this.
Is there a way to make a generic #== or some Module that I can include ?
I surely need it to do assert_equal on unit test.
You know, I just waste a couple hour tracking bug that doesn't exists
because I forgot to implement #==
TIA,
-- Zakaria
(e-mail address removed) Yahoo!: z4k4ri4
http://zakaria.is-a-geek.org
http://pemula.linux.or.id