From 3bb53d7343915e1a9f75f5ca4b53d61313b0ef29 Mon Sep 17 00:00:00 2001 From: Stormwind Date: Sat, 5 Jan 2013 18:30:36 +0100 Subject: Kill almost all mutants in Zero::Request:AcceptType Killed 13 of 14 mutants. I will see later, how it's possible to kill the last one. I also fixed the return value of "preferred", if the in initialize given string is empty. Fixed the default value here. --- lib/zero/request/accept_type.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/zero/request/accept_type.rb b/lib/zero/request/accept_type.rb index 918bf24..a8f5dc9 100644 --- a/lib/zero/request/accept_type.rb +++ b/lib/zero/request/accept_type.rb @@ -8,11 +8,8 @@ module Zero # create a new instance of AcceptType def initialize(string) - if string.nil? - @elements = [] - else - @elements = parse_elements(string) - end + string = '*/*' if string.nil? or string.empty? + @elements = parse_elements(string) end # return the preferred type @@ -30,7 +27,7 @@ module Zero # converts the accept string to a useable array # @param string the string containing media ranges and options - def parse_elements(string = '*/*') + def parse_elements(string) string. gsub(/\s/, ''). split(MEDIA_TYPE_SEPERATOR). -- cgit v1.2.3-70-g09d2