Sha256: bb8c7ddf325dae6fe225e9e388c4bb7aa9fb533db73bfbf05c6290a5daab7465

Contents?: true

Size: 548 Bytes

Versions: 8

Compression:

Stored size: 548 Bytes

Contents

module Glimmer
  class Calculator
    class Command
      class Number < Command
        keywords ('0'..'9').to_a
              
        def execute
          self.result = last_result.nil? || (!last_command.number? && !last_command.point?) ? button : last_result + button
          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/number.rb
glimmer-cs-calculator-1.1.3 lib/models/glimmer/calculator/command/number.rb
glimmer-cs-calculator-1.1.2 lib/models/glimmer/calculator/command/number.rb
glimmer-cs-calculator-1.1.1 lib/models/glimmer/calculator/command/number.rb
glimmer-cs-calculator-1.1.0 lib/models/glimmer/calculator/command/number.rb
glimmer-cs-calculator-1.0.2 lib/models/glimmer/calculator/command/number.rb
glimmer-cs-calculator-1.0.1 lib/models/glimmer/calculator/command/number.rb
glimmer-cs-calculator-1.0.0 lib/models/glimmer/calculator/command/number.rb