Sha256: 47947f2e21ab35e5420c29f3c2be5b7ad4b693ac322e56abe7e3e54895b218b9

Contents?: true

Size: 499 Bytes

Versions: 8

Compression:

Stored size: 499 Bytes

Contents

module Glimmer
  class Calculator
    class Command
      class Point < Command
        keyword '.'

        def execute          
          self.result = last_result.nil? || !last_command.number? ? '0.' : "#{last_result}."
          if operation.nil? || last_command.equals?
            self.number1 = self.result
            self.number2 = nil
            self.operation = nil            
          else
            self.number2 = self.result
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

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