Added != operator to filter. (#1930)

* Added != operator to filter.

* Update cli_helper.rb

(cherry picked from commit 5447d8a367)
This commit is contained in:
Alejandro Huertas Herrero authored and Tino Vazquez committed 2018-04-05 13:30:55 +02:00
1 parent d2c4443ee1
commit 48e8e10971
1 file changed
+4 -3
+4 -3
View File
@@ -369,7 +369,7 @@ module CLIHelper
def filter_data!(data, filter)
# TBD: add more operators
# operators=/(==|=|!=|<|<=|>|>=)/
operators=/(=)/
operators=/(=|!=)/
stems=filter.map do |s|
m=s.match(/^(.*?)#{operators}(.*?)$/)
@@ -394,11 +394,12 @@ module CLIHelper
end
end
data.reject! do |d|
data.select! do |d|
pass=true
stems.each do |s|
if d[s[:index]]!=s[:right]
if d[s[:index]].public_send(s[:operator] == "=" ? "==" : s[:operator], s[:right])
pass=false
break
end