class Flor::Pro::Cmp

Public Instance Methods

pre_execute() click to toggle source
# File lib/flor/pcore/cmp.rb, line 7
def pre_execute

  @node['rets'] = []
end
receive_last() click to toggle source
# File lib/flor/pcore/cmp.rb, line 12
def receive_last

  payload['ret'] =
    if @node['rets'].size > 1
      case tree[0]
      when '=', '==' then check_equal
      when '!=', '<>' then ! check_equal
      when '<', '>', '>=', '<=' then check_lesser
      else true
      end
    else
      true
    end

  wrap_reply
end

Protected Instance Methods

check_equal() click to toggle source
# File lib/flor/pcore/cmp.rb, line 31
def check_equal

  @node['rets'].first == @node['rets'].last
end
check_lesser() click to toggle source
# File lib/flor/pcore/cmp.rb, line 36
def check_lesser

  a, b = @node['rets'][-2], @node['rets'][-1]

  case tree[0]
  when '<' then return false if a >= b
  when '<=' then return false if a > b
  when '>' then return false if a <= b
  when '>=' then return false if a < b
  end

  true
end