lib/code/node/if.rb in code-ruby-0.5.6 vs lib/code/node/if.rb in code-ruby-0.6.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
class Code
class Node
class If < Node
IF_KEYWORD = "if"
UNLESS_KEYWORD = "unless"
@@ -11,12 +13,12 @@
def initialize(parsed)
@operator = parsed.delete(:operator)
@body = Node::Code.new(parsed.delete(:body))
- if parsed.key?(:statement)
- @statement = Node::Statement.new(parsed.delete(:statement))
- end
+ return unless parsed.key?(:statement)
+
+ @statement = Node::Statement.new(parsed.delete(:statement))
end
end
def initialize(parsed)
@first_operator = parsed.delete(:first_operator)