Sha256: c1e16a51fd3980c1d82ce8fe49af7d4a7355ed363ccc0edb7545d6f666f1ba12

Contents?: true

Size: 550 Bytes

Versions: 8

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

class Code
  class Node
    class Decimal < Node
      def initialize(parsed)
        @decimal = parsed.delete(:decimal)

        @exponent = Node::Statement.new(parsed.delete(:exponent)) if parsed.key?(:exponent)

        super(parsed)
      end

      def evaluate(**args)
        if @exponent
          ::Code::Object::Decimal.new(
            @decimal,
            exponent: @exponent.evaluate(**args)
          )
        else
          ::Code::Object::Decimal.new(@decimal)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
code-ruby-0.7.4 lib/code/node/decimal.rb
code-ruby-0.7.3 lib/code/node/decimal.rb
code-ruby-0.7.2 lib/code/node/decimal.rb
code-ruby-0.7.1 lib/code/node/decimal.rb
code-ruby-0.7.0 lib/code/node/decimal.rb
code-ruby-0.6.7 lib/code/node/decimal.rb
code-ruby-0.6.6 lib/code/node/decimal.rb
code-ruby-0.6.5 lib/code/node/decimal.rb