Sha256: bd0d7c78c6eff49a11e4ad570a525d013754a52909a361e9a007a9a90d2e61cd
Contents?: true
Size: 807 Bytes
Versions: 8
Compression:
Stored size: 807 Bytes
Contents
# Author:: Eric Crane (mailto:eric.crane@mac.com) # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved. # # An Operator; part of an expression. # module Gloo module Core class Op # Is the token an operator? def self.op?( token ) return [ '+', '-', '*', '/' ].include?( token.strip ) end # Create the operator for the given token. def self.create_op( token ) return Gloo::Expr::OpMinus.new if token == '-' return Gloo::Expr::OpMult.new if token == '*' return Gloo::Expr::OpDiv.new if token == '/' return Gloo::Expr::OpPlus.new if token == '+' return default_op end # Get the default operator (+). def self.default_op return Gloo::Expr::OpPlus.new end end end end
Version data entries
8 entries across 8 versions & 1 rubygems