refactor(logic): reuse compatible_type
This commit is contained in:
parent
06c025b5a5
commit
478a7e68ab
1 changed files with 1 additions and 8 deletions
|
@ -178,14 +178,7 @@ class TypesDeChampEditor::ConditionsComponent < ApplicationComponent
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_right_valid?(left, right)
|
def current_right_valid?(left, right)
|
||||||
case [left.type, right.type]
|
Logic.compatible_type?(left, right)
|
||||||
in [:boolean, :boolean] | [:number, :number] | [:empty, :empty]
|
|
||||||
true
|
|
||||||
in [:enum, :string]
|
|
||||||
left.options.map(&:second).include?(right.value)
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_condition_tag
|
def add_condition_tag
|
||||||
|
|
Loading…
Reference in a new issue