Module: Q::Monomial2

Defined in:
lib/q/parser.rb

Instance Method Summary collapse

Instance Method Details

#eval(scope) ⇒ Object



799
800
801
802
803
804
805
806
# File 'lib/q/parser.rb', line 799

def eval scope
  if has_feet?
    feet = tail.elements.first.feet
    return operator.apply(scope, head, feet)
  end

  scope['_'] = head.eval(scope)
end

#has_feet?Boolean

Returns:

  • (Boolean)


808
809
810
# File 'lib/q/parser.rb', line 808

def has_feet?
  not tail.nil? and not tail.elements.first.nil? and not tail.elements.first.feet.nil?
end

#operatorObject



812
813
814
815
816
# File 'lib/q/parser.rb', line 812

def operator
  return nil if not has_feet?

  tail.elements.first.operator
end