Sha256: 7bcec33efc965729f81337251ec2c67c255ec9c3ecae6918add09a5023b72f0a

Contents?: true

Size: 378 Bytes

Versions: 7

Compression:

Stored size: 378 Bytes

Contents

module Glimmer
  class Calculator
    class Command
      class Equals < Command
        keywords '=', "\r"

        def execute
          if number1 && number2 && operation
            self.result = operation.calculate.to_s
            self.number1 = self.result
          else
            self.result = last_result || '0'
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
glimmer-cs-calculator-1.1.4 lib/models/glimmer/calculator/command/equals.rb
glimmer-cs-calculator-1.1.3 lib/models/glimmer/calculator/command/equals.rb
glimmer-cs-calculator-1.1.2 lib/models/glimmer/calculator/command/equals.rb
glimmer-cs-calculator-1.1.1 lib/models/glimmer/calculator/command/equals.rb
glimmer-cs-calculator-1.1.0 lib/models/glimmer/calculator/command/equals.rb
glimmer-cs-calculator-1.0.2 lib/models/glimmer/calculator/command/equals.rb
glimmer-cs-calculator-1.0.1 lib/models/glimmer/calculator/command/equals.rb