in serialization rename op to term
This commit is contained in:
parent
87385d03fd
commit
350d32c369
6 changed files with 6 additions and 6 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class Logic::Constant < Logic::Term
|
|||
|
||||
def to_h
|
||||
{
|
||||
"op" => self.class.name,
|
||||
"term" => self.class.name,
|
||||
"value" => @value,
|
||||
"id" => @id
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ class Logic::Empty < Logic::Term
|
|||
|
||||
def to_h
|
||||
{
|
||||
"op" => self.class.name,
|
||||
"term" => self.class.name,
|
||||
"id" => @id
|
||||
}
|
||||
end
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue