in serialization rename op to term

This commit is contained in:
simon lehericey 2022-07-05 14:47:32 +02:00
parent 87385d03fd
commit 350d32c369
6 changed files with 6 additions and 6 deletions

View file

@ -1,6 +1,6 @@
module Logic
def self.from_h(h)
class_from_name(h['op']).from_h(h)
class_from_name(h['term']).from_h(h)
end
def self.from_json(s)

View file

@ -8,7 +8,7 @@ class Logic::BinaryOperator < Logic::Term
def to_h
{
"op" => self.class.name,
"term" => self.class.name,
"left" => @left.to_h,
"right" => @right.to_h,
"id" => @id

View file

@ -60,7 +60,7 @@ class Logic::ChampValue < Logic::Term
def to_h
{
"op" => self.class.name,
"term" => self.class.name,
"stable_id" => @stable_id,
"id" => @id
}

View file

@ -34,7 +34,7 @@ class Logic::Constant < Logic::Term
def to_h
{
"op" => self.class.name,
"term" => self.class.name,
"value" => @value,
"id" => @id
}

View file

@ -11,7 +11,7 @@ class Logic::Empty < Logic::Term
def to_h
{
"op" => self.class.name,
"term" => self.class.name,
"id" => @id
}
end

View file

@ -8,7 +8,7 @@ class Logic::NAryOperator < Logic::Term
def to_h
{
"op" => self.class.name,
"term" => self.class.name,
"operands" => @operands.map(&:to_h),
"id" => @id
}