-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
The following conditional found in lib/punchblock/component/output.rb has a misleading final elsif:
def xml_value
if ssml?
value.to_s
elsif urilist?
value.to_s
elsif
value
end
endOne may think that the above elsif is equivalent to ... else value end or ... elsif value; value end, but neither is the case. As seen in this gist, it's a strange, empty elsif block with nil as a return value. The method is functionally equivalent to the following:
def xml_value
if ssml?
value.to_s
elsif urilist?
value.to_s
elsif value
nil
end
endAdditionally, if we change that nil to ">FOO!" the test suite continues to pass. So while this is a private method, we should probably fix this and ensure it is tested.
What is the desired outcome of this case? value, value.to_s, or KABOOM! with a raised exception?
Metadata
Metadata
Assignees
Labels
No labels