class PostInFix::Postfix

Public Class Methods

new(postfix_array) click to toggle source
# File lib/post_in_fix/postfix.rb, line 5
def initialize(postfix_array)
  @pf = postfix_array
end

Public Instance Methods

to_solr() click to toggle source
# File lib/post_in_fix/postfix.rb, line 9
def to_solr
  stack = []
  @pf.each do |entry|
    if entry.is_a?(Operator)
      right = stack.pop
      left = stack.pop
      stack.push(entry.solr_apply(left, right))
    else
      stack.push(entry)
    end
  end
  stack.pop
end