Sha256: 4dcf7e066d2243f520ad3eb3d4def89722df79ed2d80a9e4a02bc13f9de0e0ea

Contents?: true

Size: 742 Bytes

Versions: 32

Compression:

Stored size: 742 Bytes

Contents

# frozen_string_literal: true

class Code
  class Node
    class Number < Node
      def initialize(parsed)
        if parsed.key?(:decimal)
          @statement = Node::Decimal.new(parsed.delete(:decimal))
        elsif parsed.key?(:base_16)
          @statement = Node::Base16.new(parsed.delete(:base_16))
        elsif parsed.key?(:base_10)
          @statement = Node::Base10.new(parsed.delete(:base_10))
        elsif parsed.key?(:base_8)
          @statement = Node::Base8.new(parsed.delete(:base_8))
        elsif parsed.key?(:base_2)
          @statement = Node::Base2.new(parsed.delete(:base_2))
        end

        super(parsed)
      end

      def evaluate(**args)
        @statement.evaluate(**args)
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
code-ruby-0.10.4 lib/code/node/number.rb
code-ruby-0.10.3 lib/code/node/number.rb
code-ruby-0.10.2 lib/code/node/number.rb
code-ruby-0.10.1 lib/code/node/number.rb
code-ruby-0.10.0 lib/code/node/number.rb
code-ruby-0.9.3 lib/code/node/number.rb
code-ruby-0.9.2 lib/code/node/number.rb
code-ruby-0.9.1 lib/code/node/number.rb
code-ruby-0.9.0 lib/code/node/number.rb
code-ruby-0.8.5 lib/code/node/number.rb
code-ruby-0.8.4 lib/code/node/number.rb
code-ruby-0.8.3 lib/code/node/number.rb
code-ruby-0.8.2 lib/code/node/number.rb
code-ruby-0.8.1 lib/code/node/number.rb
code-ruby-0.8.0 lib/code/node/number.rb
code-ruby-0.7.8 lib/code/node/number.rb
code-ruby-0.7.7 lib/code/node/number.rb
code-ruby-0.7.6 lib/code/node/number.rb
code-ruby-0.7.5 lib/code/node/number.rb
code-ruby-0.7.4 lib/code/node/number.rb