Sha256: 3aff360b62c1164d7ca5ce7af1270c32c3297d047d9438bbfb22dc3201546f69

Contents?: true

Size: 513 Bytes

Versions: 29

Compression:

Stored size: 513 Bytes

Contents

# Author::    Eric Crane  (mailto:eric.crane@mac.com)
# Copyright:: Copyright (c) 2019 Eric Crane.  All rights reserved.
#
# Addition operator.
#

module GlooLang
  module Expr
    class OpPlus < GlooLang::Core::Op

      #
      # Perform the operation and return the result.
      #
      def perform( left, right )
        return left + right.to_s if left.is_a? String

        return left + right.to_i if left.is_a? Integer

        return left + right.to_f if left.is_a? Numeric
      end

    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
gloo-lang-1.4.3 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.4.2 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.4.1 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.4.0 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.3.2 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.3.1 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.3.0 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.8 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.7 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.6 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.5 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.4 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.3 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.2 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.1 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.2.0 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.1.0 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.0.2 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.0.1 lib/gloo_lang/expr/op_plus.rb
gloo-lang-1.0.0 lib/gloo_lang/expr/op_plus.rb