lib/code/node/decimal.rb in code-ruby-0.13.1 vs lib/code/node/decimal.rb in code-ruby-0.14.0
- old
+ new
@@ -3,14 +3,15 @@
class Code
class Node
class Decimal < Node
def initialize(parsed)
return if parsed.blank?
+
@decimal = parsed.delete(:decimal).presence
- if parsed.key?(:exponent)
- @exponent = Statement.new(parsed.delete(:exponent).presence)
- end
+ return unless parsed.key?(:exponent)
+
+ @exponent = Statement.new(parsed.delete(:exponent).presence)
end
def evaluate(**args)
if @exponent && @decimal
Object::Decimal.new(@decimal, @exponent.evaluate(**args))