Sha256: 02fdf5bb8a2b9e916e7319ac9024e6b9085b756624ba3d5c714eadb31d60df84

Contents?: true

Size: 541 Bytes

Versions: 21

Compression:

Stored size: 541 Bytes

Contents

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

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

        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

21 entries across 21 versions & 3 rubygems

Version Path
template-ruby-0.5.6 lib/code/node/decimal.rb
language-ruby-0.5.6 lib/code/node/decimal.rb
code-ruby-0.5.6 lib/code/node/decimal.rb
template-ruby-0.5.5 lib/code/node/decimal.rb
language-ruby-0.5.5 lib/code/node/decimal.rb
code-ruby-0.5.5 lib/code/node/decimal.rb
template-ruby-0.5.4 lib/code/node/decimal.rb
language-ruby-0.5.4 lib/code/node/decimal.rb
code-ruby-0.5.4 lib/code/node/decimal.rb
template-ruby-0.5.3 lib/code/node/decimal.rb
language-ruby-0.5.3 lib/code/node/decimal.rb
code-ruby-0.5.3 lib/code/node/decimal.rb
template-ruby-0.5.2 lib/code/node/decimal.rb
language-ruby-0.5.2 lib/code/node/decimal.rb
code-ruby-0.5.2 lib/code/node/decimal.rb
language-ruby-0.5.1 lib/code/node/decimal.rb
template-ruby-0.5.1 lib/code/node/decimal.rb
code-ruby-0.5.1 lib/code/node/decimal.rb
template-ruby-0.5.0 lib/code/node/decimal.rb
language-ruby-0.5.0 lib/code/node/decimal.rb