From fe7e2e4f74e54282d19a725655f1800140a7417c Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 16 Jun 2015 22:48:42 +0200 Subject: [PATCH] Use ternary "if" when encoding attribute values --- lib/oga/xml/attribute.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/oga/xml/attribute.rb b/lib/oga/xml/attribute.rb index 370aa62..5e5d7f5 100644 --- a/lib/oga/xml/attribute.rb +++ b/lib/oga/xml/attribute.rb @@ -101,11 +101,7 @@ module Oga full_name = name end - if value - enc_value = Entities.encode_attribute(value) - else - enc_value = nil - end + enc_value = value ? Entities.encode_attribute(value) : nil %Q(#{full_name}="#{enc_value}") end