Class: Hesabu::EquationCleaner

Inherits:
Object
  • Object
show all
Defined in:
lib/hesabu/equation_cleaner.rb

Class Method Summary collapse

Class Method Details

.clean(eq) ⇒ Object



4
5
6
7
8
9
# File 'lib/hesabu/equation_cleaner.rb', line 4

def self.clean(eq)
  clean_eq = eq.gsub(" AND ", " && ")
  clean_eq.split(/(<=|>=|!=|==|=|\*|\s)/m)
          .map { |a| a == "=" ? "==" : a }
          .join("")
end