Module: Q::Binomial2

Defined in:
lib/q/parser.rb

Instance Method Summary collapse

Instance Method Details

#eval(scope) ⇒ Object



660
661
662
663
664
665
666
# File 'lib/q/parser.rb', line 660

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

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

#feetObject



672
673
674
675
676
# File 'lib/q/parser.rb', line 672

def feet
  return nil if not has_feet?

  tail.elements.first.feet
end

#has_feet?Boolean

Returns:

  • (Boolean)


668
669
670
# File 'lib/q/parser.rb', line 668

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

#operatorObject



678
679
680
681
682
# File 'lib/q/parser.rb', line 678

def operator
  return nil if not has_feet?

  tail.elements.first.operator
end