Method: Operations#process_operations

Defined in:
lib/operations.rb

#process_operations(l) ⇒ Object



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/operations.rb', line 105

def process_operations l
  return false unless l[Operator] 
  operations = []
  while l != ""
    operations << l[/#{Operand}#{Operator}#{Operand}/]
    if l[/#{Operand}#{Operator}/]
      l[/#{Operand}#{Operator}/] = ''
    else
      l = ""
    end
  end
  return false if operations == []
  operations.compact.reverse.each {|operation| 
    unless process_operation operation
      return false
    end
  }
  return true
end