implements inspect for copy paste into tests

This commit is contained in:
Torsten Ruger
2014-05-10 12:54:10 +03:00
parent 051b0ea7dc
commit 20128627c7
5 changed files with 43 additions and 15 deletions

View File

@@ -15,7 +15,13 @@ module Ast
def compile context
raise "abstract #{self}"
end
def compare other , attributes
def inspectt
self.class.name + ".new(" + self.attributes.collect{|m| self.send(m).inspect }.join( ",") +")"
end
def attributes
raise "abstract #{self}"
end
def == other
return false unless other.class == self.class
attributes.each do |a|
left = send(a)