Sha256: 2c83a259808d8242cbc3183e5c6f0f95b9deef62a3d064c9b95cfc2f9bb33cc5
Contents?: true
Size: 702 Bytes
Versions: 10
Compression:
Stored size: 702 Bytes
Contents
# frozen_string_literal: true class Code class Node class Base10 < Node def initialize(parsed) @whole = parsed.delete(:whole) if parsed.key?(:exponent) @exponent = Node::Statement.new(parsed.delete(:exponent)) end super(parsed) end def evaluate(**args) if @exponent exponent = @exponent.evaluate(**args) if exponent.is_a?(::Code::Object::Integer) ::Code::Object::Integer.new(@whole.to_i, exponent:) else ::Code::Object::Decimal.new(@whole, exponent:) end else ::Code::Object::Integer.new(@whole.to_i) end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems