30 lines
602 B
Ruby
30 lines
602 B
Ruby
module Ast
|
|
|
|
class ArrayExpression < Expression
|
|
attr_reader :values
|
|
def initialize vals
|
|
@values = vals
|
|
end
|
|
def inspect
|
|
self.class.name + ".new(" + values.to_s+ ")"
|
|
end
|
|
def attributes
|
|
[:values]
|
|
end
|
|
end
|
|
class AssociationExpression < Expression
|
|
attr_reader :key , :value
|
|
def initialize key , value
|
|
@key , @value = key , value
|
|
end
|
|
def inspect
|
|
self.class.name + ".new(" + key.inspect + " , " + value.inspect + ")"
|
|
end
|
|
def attributes
|
|
[:key , :value]
|
|
end
|
|
|
|
end
|
|
class HashExpression < ArrayExpression
|
|
end
|
|
end |