Sha256: 25db3073a7e7e29b2badb4643a20e8855cfeda44545f5279489dbd49980d32b3

Contents?: true

Size: 516 Bytes

Versions: 1

Compression:

Stored size: 516 Bytes

Contents

class Code
  class Node
    class Base10Integer
      def initialize(number)
        @sign = number[:sign]
        @whole = number.fetch(:whole)

        if number.key?(:exponent)
          @exponent = ::Code::Node::Base10Number.new(number[:exponent])
        end
      end

      def evaluate(context)
        @exponent = @exponent.evaluate(context) if @exponent
        ::Code::Object::Integer.new("#{sign}#{whole}", exponent: @exponent)
      end

      private

      attr_reader :sign, :whole
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
template-ruby-0.1.0 lib/code/node/base_10_integer.rb