lib/code/node/if.rb in code-ruby-0.13.1 vs lib/code/node/if.rb in code-ruby-0.14.0
- old
+ new
@@ -11,25 +11,27 @@
class Else < Node
attr_reader :operator, :statement, :body
def initialize(parsed)
return if parsed.blank?
+
@operator = parsed.delete(:operator).presence
@body = Node::Code.new(parsed.delete(:body).presence)
- if parsed.key?(:statement)
- @statement = Node::Statement.new(parsed.delete(:statement).presence)
- end
+ return unless parsed.key?(:statement)
+
+ @statement = Node::Statement.new(parsed.delete(:statement).presence)
end
end
def initialize(parsed)
return if parsed.blank?
+
@first_operator = parsed.delete(:first_operator).presence
@first_statement =
Node::Statement.new(parsed.delete(:first_statement).presence)
@first_body = Node::Code.new(parsed.delete(:first_body).presence)
- @elses = (parsed.delete(:elses).presence || [])
+ @elses = parsed.delete(:elses).presence || []
@elses.map! { |elses| Node::If::Else.new(elses) }
end
def evaluate(**args)
if @first_operator == IF_KEYWORD &&