From 46ef84aed94360083e4f6bf7a38c1408f13d091a Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Fri, 23 Nov 2012 20:52:56 +0000 Subject: Ensure that parse_line is given a line. --- lib/custodian/parser.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/custodian/parser.rb b/lib/custodian/parser.rb index d8b90a1..b80c498 100644 --- a/lib/custodian/parser.rb +++ b/lib/custodian/parser.rb @@ -252,6 +252,8 @@ module Custodian # def parse_line( line ) + raise ArgumentError, "Line is not a string: #{line}" unless( line.kind_of? String ) + line.chomp! if ( !line.nil? ) # @@ -341,10 +343,11 @@ module Custodian # If we're given a string then split it on newline # if ( text.kind_of?( String ) ) - a = text.split( /[\r\n]/ ) + a = text.split( /[\r\n]/ ) text = a end + ret = nil # # Split on newline @@ -369,6 +372,8 @@ module Custodian end end end + + ret end -- cgit v1.2.1