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

@ -4,8 +4,13 @@ module Ast
def initialize name, params, block
@name, @params, @block = name, params, block
end
def == other
compare other , [:name, :params, :block]
def attributes
[:name, :params, :block]
end
def inspect
self.class.name + ".new(" + name.inspect + ", ["+
params.collect{|m| m.inspect }.join( ",") +"] , [" +
block.collect{|m| m.inspect }.join( ",") +"] )"
end
def compile context